Index: trunk/MagicSoft/Simulation/Detector/include-MTrigger/MGTriggerSignal.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MTrigger/MGTriggerSignal.cxx	(revision 352)
+++ trunk/MagicSoft/Simulation/Detector/include-MTrigger/MGTriggerSignal.cxx	(revision 352)
@@ -0,0 +1,358 @@
+//
+//
+//
+#include "MGTriggerSignal.hxx" 
+
+#include "TPavesText.h"
+#include "TObjArray.h"
+#include "TCanvas.h"
+
+MGTriggerSignal::MGTriggerSignal(const MMcEvt    *McInfo, 
+				 const TObjArray *aList, 
+				 const TObjArray *dList, 
+				 const TGWindow *p, const TGWindow *main,
+                       UInt_t w, UInt_t h, UInt_t options) :
+     TGTransientFrame(p, main, w, h, options)
+{
+  //  Default constructor
+  //
+  // Create a frame to show the signals.
+  // 
+  // 
+
+  iAnaSigs =  aList->GetEntries() ; 
+  iDigSigs =  dList->GetEntries() ; 
+
+  iPage = 1 ;  
+
+  //
+  //  at the beginning copy the aList into Liste    
+  //
+  
+  ListeA = new TObjArray( *aList ) ; 
+  ListeD = new TObjArray( *dList ) ; 
+
+  Liste  = new TObjArray( *ListeA ) ; 
+  
+  
+  //
+  //  First of all the Menus in the menubar
+  //
+   
+  fMenuFile = new TGPopupMenu(gClient->GetRoot());
+  fMenuFile->AddEntry("Open...", M_FILE_OPEN);
+  fMenuFile->AddEntry("Save", M_FILE_SAVE);
+  fMenuFile->AddEntry("Save as...", M_FILE_SAVEAS);
+  fMenuFile->AddEntry("Close", M_FILE_CLOSE);
+  fMenuFile->AddSeparator();
+  fMenuFile->AddEntry("Print", M_FILE_PRINT);
+  fMenuFile->AddSeparator();
+  fMenuFile->AddEntry("Exit", M_FILE_EXIT );
+  
+  fMenuFile->DisableEntry(M_FILE_OPEN);
+  fMenuFile->DisableEntry(M_FILE_SAVE);
+  fMenuFile->DisableEntry(M_FILE_SAVEAS);
+  fMenuFile->DisableEntry(M_FILE_CLOSE);
+  fMenuFile->DisableEntry(M_FILE_PRINT);
+  fMenuFile->DisableEntry(M_FILE_EXIT);
+
+  fMenuFile->Associate(this);
+
+  //
+  //   create the menu bar
+  //
+
+  fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
+  fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
+
+  AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
+				       0, 0, 1, 1));
+
+  //
+  //    create the information frame
+  // 
+
+  Char_t winf[100]; 
+  fMcInfo = new TGCompositeFrame(this, 60, 20, kHorizontalFrame | kLHintsTop |kSunkenFrame );
+  sprintf ( winf,"Particle: %d", McInfo->GetPartId() ); 
+  fMcInfo->AddFrame(new TGLabel (fMcInfo, winf ),
+		    new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					10, 10, 10, 10));  
+
+  sprintf ( winf,"Energy: %6.1f [GeV]", McInfo->GetEnergy() ); 
+  fMcInfo->AddFrame(new TGLabel (fMcInfo, winf ),
+		    new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					10, 10, 10, 10));  
+
+  sprintf ( winf,"Theta: %6.1f [deg]", McInfo->GetTheta()* 57.2974 ); 
+  fMcInfo->AddFrame(new TGLabel (fMcInfo, winf ),
+		    new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					10, 10, 10, 10));  
+ 
+  sprintf ( winf,"Impact: %6.1f [m]", McInfo->GetImpact()/100. ); 
+  fMcInfo->AddFrame(new TGLabel (fMcInfo, winf ),
+		    new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					10, 10, 10, 10));  
+
+  AddFrame(fMcInfo, new TGLayoutHints(kLHintsTop | kLHintsExpandX,
+				      0, 0, 1, 0));
+
+  //
+  //   build the canvas (here we will plot the histograms
+  //
+
+  fCanvasWindow = new TRootEmbeddedCanvas("test",this, 800, 500);
+  fContainer = new TGCompositeFrame(fCanvasWindow->GetViewPort(), 10, 10,
+				    kHorizontalFrame, GetWhitePixel());
+  fContainer->SetLayoutManager(new TGTileLayout(fContainer, 7));
+  fCanvasWindow->SetContainer(fContainer);
+  
+  tcan = fCanvasWindow->GetCanvas() ; 
+
+  AddFrame(fCanvasWindow, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
+  				    0, 0, 2, 2));
+  
+
+  //
+  //  build the control frame
+  //
+  fControl = new TGCompositeFrame(this, 60, 20, kHorizontalFrame | kLHintsTop |kSunkenFrame );
+  
+  fPrevChannels = new TGTextButton(fControl, "Previous Channels", M_PREV_CHANNELS);
+  fPrevChannels->Associate(this);
+  fPrevChannels->SetToolTipText("To see the previous sample of chanels");
+  fControl->AddFrame(fPrevChannels, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
+
+
+  lPage = new TGLabel (fControl, "--") ;
+  fControl->AddFrame(lPage,
+		     new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+                                          5, 0, 10, 5));
+  sprintf ( winf,"/"); 
+  fControl->AddFrame(new TGLabel (fControl, "/" ),
+		     new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					0, 0, 10, 5));
+  
+  lPageAll = new TGLabel (fControl, "--") ;
+  fControl->AddFrame(lPageAll,
+		     new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+                                          0, 5, 10, 5));
+   
+  fNextChannels = new TGTextButton(fControl, "Next Channels", M_NEXT_CHANNELS);
+  fNextChannels->Associate(this);
+  fNextChannels->SetToolTipText("To see the next sample of chanels");
+  fControl->AddFrame(fNextChannels, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
+
+
+  fAnalog = new TGTextButton(fControl, "analog", M_ANALOG);
+  fAnalog->Associate(this);
+  fAnalog->SetToolTipText("Display of analog signals");
+  fControl->AddFrame(fAnalog, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 50, 5, 5, 5));
+
+
+  fDigital = new TGTextButton(fControl, "digital", M_DIGITAL);
+  fDigital->Associate(this);
+  fDigital->SetToolTipText("Display of digital signals");
+  fControl->AddFrame(fDigital, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
+
+
+  fBeide = new TGTextButton(fControl, "both", M_BEIDE);
+  fBeide->Associate(this);
+  fBeide->SetToolTipText("Display the analog and digital signals");
+  fControl->AddFrame(fBeide, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
+
+
+
+  AddFrame(fControl, new TGLayoutHints(kLHintsExpandX,
+				       0, 0, 1, 0));
+  
+
+  //
+  //    the close button line
+  // 
+
+  fFrame = new TGCompositeFrame(this, 60, 20, kHorizontalFrame |
+				kSunkenFrame);
+
+  fCloseButton = new TGTextButton(fFrame, "Close", M_BUTTON_CLOSE);
+  fCloseButton->Associate(this);
+  fCloseButton->SetToolTipText("Close and skip to the next event!");
+  fFrame->AddFrame(fCloseButton, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 100, 5, 5, 5));
+ 
+
+  fExitButton = new TGTextButton(fFrame, "Stop Job", M_BUTTON_EXIT);
+  fExitButton->Associate(this);
+  fExitButton->SetToolTipText("Shut down this job!");
+  fFrame->AddFrame(fExitButton, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 200, 5, 5, 5));
+
+  AddFrame(fFrame, new TGLayoutHints(kLHintsBottom | kLHintsExpandX,
+				     0, 0, 1, 0));
+  
+  SetWindowName("MGTriggerSignal");
+
+  MapSubwindows();
+
+  // we need to use GetDefault...() to initialize the layout algorithm...
+  Resize(GetDefaultSize());
+
+  //  Resize (1000,650); 
+
+  MapWindow();
+
+  DisplayChannels ( Liste) ; 
+  
+  gClient->WaitFor(this);  
+}
+
+
+MGTriggerSignal::~MGTriggerSignal() {
+  delete  fMenuBar ; 
+  delete  fMenuFile; 
+
+  delete  fContainer ; 
+  delete  fCanvasWindow ; 
+
+  delete  fCloseButton ; 
+  delete  fExitButton ; 
+  delete  fFrame ; 
+}
+
+void MGTriggerSignal::CloseWindow() {
+   delete this ; 
+}
+
+
+void MGTriggerSignal::DisplayChannels ( TObjArray *disList ) {
+  
+  Int_t imax ; 
+
+  if ( iPage == 0 ) {
+    printf ("Warning from DisplayChannels: Page 0 don't exist!!\n"); 
+    iPage = 1 ;
+    return ; 
+  }
+  
+  if ( (iPage-1)*16 >= (imax = disList->GetEntries()) ) {
+    printf ("Warning from DisplayChannels: PageNumber to big!\n");
+    iPage=iPage-1 ; 
+    return;
+  } 
+  
+  Char_t wort[4] ; 
+  sprintf ( wort, "%d", iPage) ;   
+  lPage->SetText ( new TGString ( wort ) ) ; 
+  sprintf ( wort, "%d", imax/16 + 1 ) ;   
+  lPageAll->SetText ( new TGString ( wort ) ) ; 
+ 
+
+  tcan->Clear() ; 
+  tcan->Divide(4,4) ;
+
+  Int_t ifirst, ilast ; 
+
+  ifirst = (iPage-1)*16 ; 
+  ilast  = iPage*16 ; 
+
+  if ( ilast > imax ) {
+    ilast = imax ; 
+  }
+
+  Int_t ic = 1 ; 
+  for (Int_t ih=ifirst; ih<ilast; ih++ ) {
+    tcan->cd(ic++);
+    disList->At(ih)->Draw() ; 
+  }
+
+  tcan->Modified();
+  tcan->Update();
+  
+}
+
+// ========================================
+// ========================================
+// ========================================
+
+Bool_t MGTriggerSignal::ProcessMessage(Long_t msg, Long_t parm1, Long_t) {
+  // Handle messages send to the TestMainFrame object. E.g. all menu button
+  // messages.
+  
+  //  printf (" processmessage \n" ) ; 
+
+  switch (GET_MSG(msg)) {
+    
+  case kC_COMMAND:
+    switch (GET_SUBMSG(msg)) {
+       
+    case kCM_MENU:
+      printf("Pointer over menu entry, id=%ld\n", parm1);
+      break;
+
+      
+    case kCM_BUTTON:
+      switch ( parm1 ) {
+	
+      case M_BUTTON_CLOSE:      
+	CloseWindow() ; 
+        break; 
+
+      case M_BUTTON_EXIT:      
+        exit (1234)  ; 
+        break; 
+
+      case M_PREV_CHANNELS:
+	iPage = iPage - 1 ; 
+	DisplayChannels (Liste) ; 
+	break; 
+
+      case M_NEXT_CHANNELS:
+	iPage = iPage + 1 ; 
+	DisplayChannels (Liste) ; 
+	break; 
+
+      case M_ANALOG:
+	Liste  = new TObjArray( *ListeA ) ;
+	DisplayChannels (Liste) ; 
+	break; 
+
+      case M_DIGITAL:
+	Liste  = new TObjArray( *ListeD ) ;
+	DisplayChannels (Liste) ; 
+	break; 
+
+      case M_BEIDE:
+	//
+	//  to draw the analog and the digital signal
+	//
+	Liste = new TObjArray(2*iAnaSigs) ; 
+
+	Int_t iL ; 
+	
+	for (iL = 0; iL<=(iAnaSigs); iL++ ) {
+	  Liste->Add( ListeA->At(iL) ) ; 
+	  Liste->Add( ListeD->At(iL) ) ; 
+	}
+	DisplayChannels (Liste) ; 
+	break; 
+      } 
+      
+      return kFALSE;
+    }
+    return kFALSE; 
+  }  
+  return kTRUE;
+}
+
+
+
+
+
+
+
+
Index: trunk/MagicSoft/Simulation/Detector/include-MTrigger/MGTriggerSignal.hxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MTrigger/MGTriggerSignal.hxx	(revision 352)
+++ trunk/MagicSoft/Simulation/Detector/include-MTrigger/MGTriggerSignal.hxx	(revision 352)
@@ -0,0 +1,113 @@
+#ifndef __MGTriggerSignal__
+#define __MGTriggerSignal__
+
+
+#include <stdlib.h>
+#include <iostream.h>
+
+#include <TROOT.h>
+#include <TApplication.h>
+#include <TVirtualX.h>
+
+#include <TGListBox.h>
+#include <TGClient.h>
+#include <TGFrame.h>
+#include <TGIcon.h>
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGTextEntry.h>
+#include <TGMsgBox.h>
+#include <TGMenu.h>
+#include <TGCanvas.h>
+#include <TGComboBox.h>
+#include <TGTab.h>
+#include <TGSlider.h>
+#include <TGDoubleSlider.h>
+#include <TGFileDialog.h>
+#include <TRootEmbeddedCanvas.h>
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TRandom.h>
+#include <TSystem.h>
+#include <TEnv.h>
+
+#include "MMcEvt.h"
+
+
+enum ETestCommandIdentifiers {
+   M_FILE_OPEN = 201,
+   M_FILE_SAVE,
+   M_FILE_SAVEAS,
+   M_FILE_CLOSE,
+   M_FILE_PRINT,
+   M_FILE_EXIT , 
+   
+   M_BUTTON_CLOSE,
+   M_BUTTON_EXIT,
+
+   M_PREV_CHANNELS, 
+   M_NEXT_CHANNELS,
+   M_ANALOG,
+   M_DIGITAL, 
+   M_BEIDE
+}; 
+
+
+
+
+
+class MGTriggerSignal : public TGTransientFrame {
+
+private:
+  Int_t               iAnaSigs ; 
+  Int_t               iDigSigs ;
+  Int_t               iPage  ; 
+
+  TObjArray           *ListeA ; 
+  TObjArray           *ListeD ; 
+  TObjArray           *Liste ; 
+
+  TGCompositeFrame    *fFrame ; 
+  TGButton            *fCloseButton;
+  TGButton            *fExitButton;
+
+  TGCompositeFrame    *fControl ; 
+  TGButton            *fPrevChannels;
+  TGLabel             *lPageAll    ;
+  TGLabel             *lPage    ;
+  TGButton            *fNextChannels;
+  TGButton            *fAnalog;
+  TGButton            *fDigital;
+  TGButton            *fBeide;
+
+  TGCompositeFrame    *fMcInfo ; 
+
+  TRootEmbeddedCanvas *fCanvasWindow ; 
+  TGCompositeFrame    *fContainer ; 
+  TCanvas             *tcan ; 
+
+  TGMenuBar           *fMenuBar;
+  TGPopupMenu         *fMenuFile;
+
+
+public:
+  MGTriggerSignal(const MMcEvt    *McInfo, 
+		  const TObjArray *aList,
+		  const TObjArray *dList,  
+                  const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
+		  UInt_t options = kMainFrame | kVerticalFrame);
+  virtual ~MGTriggerSignal();
+  
+  virtual void CloseWindow();
+
+  void DisplayChannels( TObjArray *disList ) ; 
+
+  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
+};
+
+#endif
+
+
+
+
Index: trunk/MagicSoft/Simulation/Detector/include-MTrigger/MTriggerDefine.h
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MTrigger/MTriggerDefine.h	(revision 352)
+++ trunk/MagicSoft/Simulation/Detector/include-MTrigger/MTriggerDefine.h	(revision 352)
@@ -0,0 +1,72 @@
+//
+//
+//      In this file are the fundamental definitions for the class MCTrigger
+//
+//
+#define TRIGGER_PIXELS        271
+//
+//      This is the number of Pixels contributing to the TRIGGER logic
+//      All Pixels-Id above that value don't do an trigger stuff. 
+//      
+//
+#define TOTAL_TRIGGER_TIME    250 
+//
+//      This values defines the total range in that we try to find
+//      a trigger. 
+//
+#define SLICES_PER_NSEC         4
+//      
+//      Each nano second is divided into the number of this values slices. 
+//      So you can get the total number of timeslices for one Pixel by 
+//      ( TOTAL_TRIGGER_TIME * SLICES_PER_NSEC ). 
+//      In the current settings this are 1000 slices
+//
+#define TRIGGER_TIME_SLICES     (TOTAL_TRIGGER_TIME*SLICES_PER_NSEC) 
+//
+//
+//
+//
+//       ------>>>   SETTINGS for the RESPONSE FUNCTION
+// 
+#define RESPONSE_SLICES        40
+//
+//       This is for the standard response Signal to 1 Photoelectron
+//       that leaves the Photocathode
+//       The whole Timescale for the signal is 10 nsec
+//
+//       The Response function
+//
+//       These values are discussed with Eckart. We start from this point. 
+//
+#define RESPONSE_FWHM          2. 
+
+#define RESPONSE_AMPLITUDE     1. 
+//
+//       This are the Standard values of the response function for
+//       1 photo electron. ( 1 means 1 mV per phote electron ) 
+//
+//
+//       -------->>> SETTINGS for the DISKRIMINATORS
+//
+//
+#define CHANNEL_THRESHOLD      2.5 
+//
+//       This is the diskriminator threshold for each individual channel
+//       First we set the value to 2 unit of the RESPONSE_AMPLITUDE 
+//
+#define TRIGGER_GATE           3. 
+// 
+//       Here we set the width of the digital signal we get if the signal
+//       passes the diskriminator
+//
+//
+//      --------->>>> SETTINGS for the TRIGGER logic
+//
+//
+#define TRIGGER_MULTI          4.  
+//
+//       We get a Level Zero Trigger, if we have a least TRIGGER_MULTI
+//       channels with a diskrimiator signal at the same time 
+//
+
+
Index: trunk/MagicSoft/Simulation/Detector/include-MTrigger/TABLE_NEXT_NEIGHBOUR
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MTrigger/TABLE_NEXT_NEIGHBOUR	(revision 352)
+++ trunk/MagicSoft/Simulation/Detector/include-MTrigger/TABLE_NEXT_NEIGHBOUR	(revision 352)
@@ -0,0 +1,331 @@
+    0       2     3     5     6     1     4 
+    1       2     6     8    18     0     7 
+    2       0     1     9    10     3     8 
+    3       0     4    10    11     2    12 
+    4       3     5    12    14     0    13 
+    5       0     4    15    16     6    14 
+    6       0     1    16    17     5    18 
+    7       8    18    20    36     1    19 
+    8       1     7     9    21     2    20 
+    9       2     8    22    23    10    21 
+   10       2     3    23    24     9    11 
+   11       3    12    24    25    10    26 
+   12       4    11    13    26     3    27 
+   13      12    14    27    29     4    28 
+   14       4    13    15    30     5    29 
+   15       5    14    31    32    16    30 
+   16       5     6    32    33    15    17 
+   17       6    18    33    34    16    35 
+   18       1     7    17    35     6    36 
+   19      20    36    38    60     7    37 
+   20       7    19    21    39     8    38 
+   21       8    20    22    40     9    39 
+   22       9    21    41    42    23    40 
+   23       9    10    42    43    22    24 
+   24      10    11    43    44    23    25 
+   25      11    26    44    45    24    46 
+   26      12    25    27    46    11    47 
+   27      13    26    28    47    12    48 
+   28      27    29    48    50    13    49 
+   29      13    28    30    51    14    50 
+   30      14    29    31    52    15    51 
+   31      15    30    53    54    32    52 
+   32      15    16    54    55    31    33 
+   33      16    17    55    56    32    34 
+   34      17    35    56    57    33    58 
+   35      18    34    36    58    17    59 
+   36       7    19    35    59    18    60 
+   37      38    60    62    90    19    61 
+   38      19    37    39    63    20    62 
+   39      20    38    40    64    21    63 
+   40      21    39    41    65    22    64 
+   41      66    67    22    40    42    65 
+   42      67    68    22    23    41    43 
+   43      68    69    23    24    42    44 
+   44      69    70    24    25    43    45 
+   45      70    71    25    46    44    72 
+   46      26    45    47    72    25    73 
+   47      27    46    48    73    26    74 
+   48      28    47    49    74    27    75 
+   49      48    50    75    77    28    76 
+   50      28    49    51    78    29    77 
+   51      29    50    52    79    30    78 
+   52      30    51    53    80    31    79 
+   53      81    82    31    52    54    80 
+   54      82    83    31    32    53    55 
+   55      83    84    32    33    54    56 
+   56      84    85    33    34    55    57 
+   57      85    86    34    58    56    87 
+   58      35    57    59    87    34    88 
+   59      36    58    60    88    35    89 
+   60      19    37    59    89    36    90 
+   61      62    90    92   126    37    91 
+   62      37    61    63    93    38    92 
+   63      38    62    64    94    39    93 
+   64      39    63    65    95    40    94 
+   65      66    96    40    64    41    95 
+   66      41    65    97    98    67    96 
+   67      41    42    98    99    66    68 
+   68      42    43    99   100    67    69 
+   69      43    44   100   101    68    70 
+   70      44    45   101   102    69    71 
+   71      45    72   102   103    70   104 
+   72      71   104    46    73    45   105 
+   73      47    72    74   105    46   106 
+   74      48    73    75   106    47   107 
+   75      49    74    76   107    48   108 
+   76      75    77   108   110    49   109 
+   77      49    76    78   111    50   110 
+   78      50    77    79   112    51   111 
+   79      51    78    80   113    52   112 
+   80      81   114    52    79    53   113 
+   81      53    80   115   116    82   114 
+   82      53    54   116   117    81    83 
+   83      54    55   117   118    82    84 
+   84      55    56   118   119    83    85 
+   85      56    57   119   120    84    86 
+   86      57    87   120   121    85   122 
+   87      86   122    58    88    57   123 
+   88      59    87    89   123    58   124 
+   89      60    88    90   124    59   125 
+   90      37    61    89   125    60   126 
+   91      92   126   128   168    61   127 
+   92      61    91    93   129    62   128 
+   93      62    92    94   130    63   129 
+   94      63    93    95   131    64   130 
+   95      96   132    64    94    65   131 
+   96      65    95    97   133    66   132 
+   97      66    96    98   133   134   135 
+   98      66    67    97    99   135   136 
+   99      67    68    98   100   136   137 
+  100      68    69    99   101   137   138 
+  101      69    70   100   102   138   139 
+  102      70    71   101   103   139   140 
+  103      71   104   102   142   140   141 
+  104      72   105   103   142    71   143 
+  105     104   143    73   106    72   144 
+  106      74   105   107   144    73   145 
+  107      75   106   108   145    74   146 
+  108      76   107   109   146    75   147 
+  109     108   110   147   149    76   148 
+  110      76   109   111   150    77   149 
+  111      77   110   112   151    78   150 
+  112      78   111   113   152    79   151 
+  113     114   153    79   112    80   152 
+  114      80   113   115   154    81   153 
+  115      81   114   116   154   155   156 
+  116      81    82   115   117   156   157 
+  117      82    83   116   118   157   158 
+  118      83    84   117   119   158   159 
+  119      84    85   118   120   159   160 
+  120      85    86   119   121   160   161 
+  121      86   122   120   163   161   162 
+  122      87   123   121   163    86   164 
+  123     122   164    88   124    87   165 
+  124      89   123   125   165    88   166 
+  125      90   124   126   166    89   167 
+  126      61    91   125   167    90   168 
+  127     128   168   170   216    91   169 
+  128      91   127   129   171    92   170 
+  129      92   128   130   172    93   171 
+  130      93   129   131   173    94   172 
+  131     132   174    94   130    95   173 
+  132      95   131   133   175    96   174 
+  133      96   132    97   175   134   176 
+  134     177   178   135   176    97   133 
+  135     178   179   134   136    97    98 
+  136     179   180   135   137    98    99 
+  137     180   181   136   138    99   100 
+  138     181   182   137   139   100   101 
+  139     182   183   138   140   101   102 
+  140     183   184   139   141   102   103 
+  141     184   185   140   186   103   142 
+  142     104   143   103   187   141   186 
+  143     105   144   142   187   104   188 
+  144     143   188   106   145   105   189 
+  145     107   144   146   189   106   190 
+  146     108   145   147   190   107   191 
+  147     109   146   148   191   108   192 
+  148     147   149   192   194   109   193 
+  149     109   148   150   195   110   194 
+  150     110   149   151   196   111   195 
+  151     111   150   152   197   112   196 
+  152     153   198   112   151   113   197 
+  153     113   152   154   199   114   198 
+  154     114   153   115   199   155   200 
+  155     201   202   156   200   115   154 
+  156     202   203   155   157   115   116 
+  157     203   204   156   158   116   117 
+  158     204   205   157   159   117   118 
+  159     205   206   158   160   118   119 
+  160     206   207   159   161   119   120 
+  161     207   208   160   162   120   121 
+  162     208   209   161   210   121   163 
+  163     122   164   121   211   162   210 
+  164     123   165   163   211   122   212 
+  165     164   212   124   166   123   213 
+  166     125   165   167   213   124   214 
+  167     126   166   168   214   125   215 
+  168      91   127   167   215   126   216 
+  169     170   216   218   270   127   217 
+  170     127   169   171   219   128   218 
+  171     128   170   172   220   129   219 
+  172     129   171   173   221   130   220 
+  173     174   222   130   172   131   221 
+  174     131   173   175   223   132   222 
+  175     132   174   133   223   176   224 
+  176     177   225   134   224   133   175 
+  177     134   176   226   227   178   225 
+  178     134   135   227   228   177   179 
+  179     135   136   228   229   178   180 
+  180     136   137   229   230   179   181 
+  181     137   138   230   231   180   182 
+  182     138   139   231   232   181   183 
+  183     139   140   232   233   182   184 
+  184     140   141   233   234   183   185 
+  185     141   186   234   235   184   236 
+  186     185   236   141   237   142   187 
+  187     143   188   142   238   186   237 
+  188     144   189   187   238   143   239 
+  189     188   239   145   190   144   240 
+  190     146   189   191   240   145   241 
+  191     147   190   192   241   146   242 
+  192     148   191   193   242   147   243 
+  193     192   194   243   245   148   244 
+  194     148   193   195   246   149   245 
+  195     149   194   196   247   150   246 
+  196     150   195   197   248   151   247 
+  197     198   249   151   196   152   248 
+  198     152   197   199   250   153   249 
+  199     153   198   154   250   200   251 
+  200     201   252   155   251   154   199 
+  201     155   200   253   254   202   252 
+  202     155   156   254   255   201   203 
+  203     156   157   255   256   202   204 
+  204     157   158   256   257   203   205 
+  205     158   159   257   258   204   206 
+  206     159   160   258   259   205   207 
+  207     160   161   259   260   206   208 
+  208     161   162   260   261   207   209 
+  209     162   210   261   262   208   263 
+  210     209   263   162   264   163   211 
+  211     164   212   163   265   210   264 
+  212     165   213   211   265   164   266 
+  213     212   266   166   214   165   267 
+  214     167   213   215   267   166   268 
+  215     168   214   216   268   167   269 
+  216     127   169   215   269   168   270 
+  217     218   270   272   330   169   271 
+  218     169   217   219   273   170   272 
+  219     170   218   220   274   171   273 
+  220     171   219   221   275   172   274 
+  221     222   276   172   220   173   275 
+  222     173   221   223   277   174   276 
+  223     174   222   175   277   224   278 
+  224     225   279   176   278   175   223 
+  225     176   224   226   280   177   279 
+  226     177   225   281   282   227   280 
+  227     177   178   282   283   226   228 
+  228     178   179   283   284   227   229 
+  229     179   180   284   285   228   230 
+  230     180   181   285   286   229   231 
+  231     181   182   286   287   230   232 
+  232     182   183   287   288   231   233 
+  233     183   184   288   289   232   234 
+  234     184   185   289   290   233   235 
+  235     185   236   290   291   234   292 
+  236     186   235   237   292   185   293 
+  237     236   293   186   294   187   238 
+  238     188   239   187   295   237   294 
+  239     189   240   238   295   188   296 
+  240     239   296   190   241   189   297 
+  241     191   240   242   297   190   298 
+  242     192   241   243   298   191   299 
+  243     193   242   244   299   192   300 
+  244     243   245   300   302   193   301 
+  245     193   244   246   303   194   302 
+  246     194   245   247   304   195   303 
+  247     195   246   248   305   196   304 
+  248     249   306   196   247   197   305 
+  249     197   248   250   307   198   306 
+  250     198   249   199   307   251   308 
+  251     252   309   200   308   199   250 
+  252     200   251   253   310   201   309 
+  253     201   252   311   312   254   310 
+  254     201   202   312   313   253   255 
+  255     202   203   313   314   254   256 
+  256     203   204   314   315   255   257 
+  257     204   205   315   316   256   258 
+  258     205   206   316   317   257   259 
+  259     206   207   317   318   258   260 
+  260     207   208   318   319   259   261 
+  261     208   209   319   320   260   262 
+  262     209   263   320   321   261   322 
+  263     210   262   264   322   209   323 
+  264     263   323   210   324   211   265 
+  265     212   266   211   325   264   324 
+  266     213   267   265   325   212   326 
+  267     266   326   214   268   213   327 
+  268     215   267   269   327   214   328 
+  269     216   268   270   328   215   329 
+  270     169   217   269   329   216   330 
+  271     272   330   332   396   217   331 
+  272     217   271   273   333   218   332 
+  273     218   272   274   334   219   333 
+  274     219   273   275   335   220   334 
+  275     276   336   220   274   221   335 
+  276     221   275   277   337   222   336 
+  277     222   276   223   337   278   338 
+  278     279   339   224   338   223   277 
+  279     224   278   280   340   225   339 
+  280     225   279   281   341   226   340 
+  281     342   343   226   280   282   341 
+  282     343   344   226   227   281   283 
+  283     344   345   227   228   282   284 
+  284     345   346   228   229   283   285 
+  285     346   347   229   230   284   286 
+  286     347   348   230   231   285   287 
+  287     348   349   231   232   286   288 
+  288     349   350   232   233   287   289 
+  289     350   351   233   234   288   290 
+  290     351   352   234   235   289   291 
+  291     352   353   235   292   290   354 
+  292     236   293   291   354   235   355 
+  293     237   292   294   355   236   356 
+  294     293   356   237   357   238   295 
+  295     239   296   238   358   294   357 
+  296     240   297   295   358   239   359 
+  297     296   359   241   298   240   360 
+  298     242   297   299   360   241   361 
+  299     243   298   300   361   242   362 
+  300     244   299   301   362   243   363 
+  301     300   302   363   365   244   364 
+  302     244   301   303   366   245   365 
+  303     245   302   304   367   246   366 
+  304     246   303   305   368   247   367 
+  305     306   369   247   304   248   368 
+  306     248   305   307   370   249   369 
+  307     249   306   250   370   308   371 
+  308     309   372   251   371   250   307 
+  309     251   308   310   373   252   372 
+  310     252   309   311   374   253   373 
+  311     375   376   253   310   312   374 
+  312     376   377   253   254   311   313 
+  313     377   378   254   255   312   314 
+  314     378   379   255   256   313   315 
+  315     379   380   256   257   314   316 
+  316     380   381   257   258   315   317 
+  317     381   382   258   259   316   318 
+  318     382   383   259   260   317   319 
+  319     383   384   260   261   318   320 
+  320     384   385   261   262   319   321 
+  321     385   386   262   322   320   387 
+  322     263   323   321   387   262   388 
+  323     264   322   324   388   263   389 
+  324     323   389   264   390   265   325 
+  325     266   326   265   391   324   390 
+  326     267   327   325   391   266   392 
+  327     326   392   268   328   267   393 
+  328     269   327   329   393   268   394 
+  329     270   328   330   394   269   395 
+  330     217   271   329   395   270   396 
