import java.io.*;
import java.util.*;
import java.net.*;
//_____________________________________________________________
public class addit
{ 
//_____________________________________________________________
public static final void main(String[] args) throws Exception
{
   addit bnk = new addit();
   bnk.start(args);
}
//_____________________________________________________________
addit() throws Exception 
{
}
//___________________________________________________________________________
void start(String[] args)
{
   String num1 = "37";
   String num2 = "73";
   if (args.length > 0) num1 = args[0];
   if (args.length > 1) num2 = args[1];
   String file1 = getFile2("cbrt" + num1 + ".txt");
   String file2 = getFile2("cbrt" + num2 + ".txt");
   int kk = file1.length() - 1;
   int carry = 0;
   StringBuffer buf = new StringBuffer();
   for (int i = kk; i>= 0; i--)
   {
      String s1 = file1.substring(i,i+1);
      String s2 = file2.substring(i,i+1);
      int n3 = 0;
      if (s1.equals("."))
      {
         buf.append(".");
         n3 = 0;
      }
      else
      {
         int v1 = Integer.parseInt(s1);
         int v2 = Integer.parseInt(s2);
         int n1 = v1 + v2 + carry;
         int n2 = n1 / 10;
         n3 = n1 % 10;
         carry = n2;  
         buf.append(n3);
      }
      //System.out.println(s1 + " " + s2 + " " + n3);
   }
   //System.out.println(reverse(buf.toString()));
   find(reverse(buf.toString()));
}
//___________________________________________________________________________
void find(String str)
{
   String[] file = data.getFile("numbers.txt").split("\r\n");
   for (int i = 0; i < file.length; i++)
   {
      if (file[i].length() < 7) continue;
      for (int j = 0; j < str.length(); j++)
      {
         for (int k = 0; k < str.length(); k++)
         {
            boolean found = true;
            for (int m = 0; m < file[i].length(); m++)
            {
               int pos = j + (k * m);
               if (pos >= str.length())
               {
                  found = false;
                  break;
               }
               if (!str.substring(pos,pos+1).equals(file[i].substring(m,m+1)))
               {
                  found = false;
                  break;
               }
            }
            if (found)
            {
               System.out.println(file[i] + " " + j + " " + k);
            }
         }
      }
   }
}
//___________________________________________________________________________
String reverse(String str)
{
   StringBuffer buf = new StringBuffer();
   for (int i = str.length()-1; i >= 0; i--)
   {
      buf.append(str.substring(i,i+1));
   }
   return(buf.toString());
}
//___________________________________________________________________________
public static 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());
}
//___________________________________________________________________________
public static String getFile2(String file) 
{
   StringBuffer buf=new StringBuffer();String str;
  try
  {
   BufferedReader in = new BufferedReader (new FileReader (file));
   while((str=in.readLine())!=null)
   {
      buf.append(str);
   }
   in.close();
  }
  catch (Exception e)
  {
   System.out.println(e);
  }
   return (buf.toString());
}
}//__________________________________________________________________________
