import java.io.*;
//_____________________________________________________________
public class fish
{ 
//_____________________________________________________________
public static final void main(String[] args) throws Exception
{
   fish bnk = new fish();
   bnk.start(args);
}
//_____________________________________________________________
fish() throws Exception 
{
}
//___________________________________________________________________________
void start(String[] args)
{
   long t1 = System.nanoTime();
   startit();
   long t2 = System.nanoTime();
   System.out.println("seconds = " + ((t2-t1)/1e9));
}
//___________________________________________________________________________
void startit()
{
   StringBuffer buf1 = new StringBuffer();
   StringBuffer buf = new StringBuffer();
   String[] file = getFile("fish_found.txt").split("\r\n");
   for (int i = 0; i < file.length; i++)
   {
      String[] words = file[i].split(" ");
      String str = words[0].trim();
      buf1.append(place(str) + " ");
   }
   String[] str1 = buf1.toString().split(" ");
   int cnt = 0;
   int[] cnt2 = new int[1000];;
   for (int i = 0; i < str1.length; i++)
   {
      for (int j = 0; j < str1.length; j++)
      {
         for (int k = 0; k < str1.length; k++)
         {
            for (int m = 0; m < str1.length; m++)
            {
               for (int n = 0; n < str1.length; n++)
               {
                  cnt++;
                  int val1 = Integer.parseInt(str1[i]);
                  int val2 = Integer.parseInt(str1[j]);
                  int val3 = Integer.parseInt(str1[k]);
                  int val4 = Integer.parseInt(str1[m]);
                  int val5 = Integer.parseInt(str1[n]);
                  int valt = val1 + val2 + val3 + val4 + val5;
                  for (int q = 1; q < 1000; q++)
                  {
                     if (valt % q == 0)
                     {
                        cnt2[q]++;
                     }
                  }
               }
            }
         }
      }
      System.out.print("*");
   }
   System.out.println("");
   for (int q = 0; q < cnt2.length; q++)
   {
      double d1 = (double) cnt / (double)cnt2[q];
      double d2 = (double) q / d1;
      if (d2 > 2.0)
      {
         buf.append(q + " " + cnt + " " + cnt2[q] + " " + d1 + " " + d2 + "\r\n");
      }
   }
   System.out.println(buf.toString());
   saveFile("fish_output.txt",buf.toString(),false);
}
//___________________________________________________________________________
String getFile(String file) 
{
   StringBuffer buf=new StringBuffer();String str;
  try
  {
   BufferedReader in = new BufferedReader (new FileReader (file));
   while((str=in.readLine())!=null)
   {
      buf.append(str+"\r\n");
   }
   in.close();
  }
  catch (Exception e)
  {
   System.out.println(e);
  }
   return (buf.toString());
}
//___________________________________________________________________________
void saveFile(String file, String str, boolean append) 
{
  try
  {
   BufferedWriter out = new BufferedWriter(new FileWriter(file, append));
   out.write(str);
   out.close();
  }
  catch (Exception e)
  {
   System.out.println(e);
  }
}
//_____________________________________________________
String convert(String tr)
{
   String out = "";
   byte[] bb = tr.getBytes();
   for (int i = 0; i < bb.length; i++)
   {
      int val = bb[i];
      if (val < 0) val += 256;
      if (val == 65) out += "&#x05d0";
      else if (val == 66) out += "&#x05d1";
      else if (val == 71) out += "&#x05d2";
      else if (val == 68) out += "&#x05d3";
      else if (val == 72) out += "&#x05d4";
      else if (val == 86) out += "&#x05d5";
      else if (val == 90) out += "&#x05d6";
      else if (val == 67) out += "&#x05d7";
      else if (val == 84) out += "&#x05d8";
      else if (val == 89) out += "&#x05d9";
      else if (val == 75) out += "&#x05da";
      else if (val == 75) out += "&#x05db";
      else if (val == 76) out += "&#x05dc";
      else if (val == 77) out += "&#x05dd";
      else if (val == 77) out += "&#x05de";
      else if (val == 78) out += "&#x05df";
      else if (val == 78) out += "&#x05e0";
      else if (val == 83) out += "&#x05e1";
      else if (val == 73) out += "&#x05e2";
      else if (val == 70) out += "&#x05e3";
      else if (val == 70) out += "&#x05e4";
      else if (val == 69) out += "&#x05e5";
      else if (val == 69) out += "&#x05e6";
      else if (val == 81) out += "&#x05e7";
      else if (val == 82) out += "&#x05e8";
      else if (val == 74) out += "&#x05e9";
      else if (val == 79) out += "&#x05ea";
      else out += (char)val;
   }
   return(out);
}
//__________________________________________________
int place(String str)
{
   int total = 0;
   String out = "";
   for (int i = 0; i < str.length(); i++)
   {
      int v = 0;
      String st2 = str.substring(i,i+1);
      byte[] st3 = st2.getBytes();
      byte st = st3[0];
      if (st == 'a') v = 1;
      else if (st == 'b') v = 2;
      else if (st == 'c') v = 3;
      else if (st == 'd') v = 4;
      else if (st == 'e') v = 5;
      else if (st == 'f') v = 6;
      else if (st == 'g') v = 7;
      else if (st == 'h') v = 8;
      else if (st == 'i') v = 9;
      else if (st == 'j') v = 10;
      else if (st == 'k') v = 11;
      else if (st == 'l') v = 12;    
      else if (st == 'm') v = 13;
      else if (st == 'n') v = 14;
      else if (st == 'o') v = 15;
      else if (st == 'p') v = 16;
      else if (st == 'q') v = 17;
      else if (st == 'r') v = 18;
      else if (st == 's') v = 19;
      else if (st == 't') v = 20;
      else if (st == 'u') v = 21;
      else if (st == 'v') v = 22;
      else if (st == 'w') v = 23;
      else if (st == 'x') v = 24;
      else if (st == 'y') v = 25;
      else if (st == 'z') v = 26;
      else if (st == 'A') v = 1;
      else if (st == 'B') v = 2;
      else if (st == 'G') v = 3;
      else if (st == 'D') v = 4;
      else if (st == 'H') v = 5;
      else if (st == 'V') v = 6;
      else if (st == 'Z') v = 7;
      else if (st == 'C') v = 8;
      else if (st == 'T') v = 9;
      else if (st == 'Y') v = 10;
      else if (st == 'K') v = 11;
      else if (st == 'L') v = 12;
      else if (st == 'M') v = 13;
      else if (st == 'N') v = 14;
      else if (st == 'S') v = 15;
      else if (st == 'I') v = 16;
      else if (st == 'F') v = 17;
      else if (st == 'E') v = 18;
      else if (st == 'Q') v = 19;
      else if (st == 'R') v = 20;
      else if (st == 'J') v = 21;
      else if (st == 'O') v = 22;
      total += v;
      if (i > 0) out += " + ";
      out += Integer.toString(v);
   }
   return(total);
}
}//__________________________________________________________________________
