
/*
Online Java - IDE, Code Editor, Compiler

Online Java is a quick and easy tool that helps you to build, compile, test your programs online.
*/
import java.util.*;

class RepeatDecimalFractions
{
    String[] testOne;
    long divisor;
    boolean successReducedNumerator;
    boolean successReducedDenominator;
    boolean isTerminatingDecimal=true;
    List<Long> notPrimeLst = new ArrayList<>();
    List<Long> primeLst = new ArrayList<>();
    
    
    //My aim initially will be to understand this. We know the repetend portion has to be non-repeating, 
    //otherwise it would not be terminating.  
    //This is foundation of my first set of test cases in which I can create a fraction and then use the decimal conversion back into my code.
    //Key points about terminating fractions: 
    //Denominator key: 
    //To check if a fraction will terminate, look at its denominator in simplest form.
    //for this I will use reducedDenominator() and reducedNumerator()
    //If the denominator only has prime factors of 2 and/or 5, the fraction will terminate
    
    //I have found this from BBC site:
    
    //There are many methods to find the prime factors of a number, 
    //but one of the most common is to use a prime factor tree:

    //Start the factor tree using any pair of factors (two numbers that multiply together to make your number).
    //If one of these factors is prime, that branch ends.
    //If a factor isn't prime, divide it into a factor pair.
    //The branches continue to expand until all the factors are prime numbers.
    //The final answer is the list of all the prime numbers displayed at the end of these branches.
    
    public void generateTerminatingNonRepeatFractions()
    {
        //rather than calling another method for confusion, I will include same code again...
        //I will try to generate denominators without prime factors (excluding 1)
        //we know I need to go up to 32 767 limit for length of X as per documentation for  1.XXXXXXXXXX
        //However to perform division, it will be subject to limits of the Long.
        //this will be a similar concept to addition challenge..
        //but this time i can use recursion aspect since in addition we discarded least significant digit and worked towards
        //mot significant digit
        //The biggest long number is:  2147483647  (this is 10 digits wide)
        
        long [] testing = new long[19];
        
        
        
        //long a = 2147483647; 
        long a = 2000;
        boolean primeNumber=false;
        
        long temp = a/a;
        
        long count=0;
        
        long arraySize = 2147483647;
        
        //not permitted
        long [] noPrimeFactor = new long[21474836];
        
        //want to check each long (which will be initially in a string)
        //for its prime factors..
        
        for (long m=2; m<a;m++)
        {
            primeNumber=true;
            //we know prime numbers can only be divided by 1 and itself.. so these are excluded.
            for (long j=2; j<(m/2);j++)
            {
                if (m%j==0)
                {
                    //we need to pass this outcome back into factor tree
                    //but its a starting point to try and figure out if it is only exactly divisible by
                    //2 and 5 to satisfy the condition...
                    
                    //System.out.println("is not a prime number: " + m);
                    notPrimeLst.add(m);
                    primeNumber=false;
                    
                   
                    
                    break;
                }
            }
            count++;
            
            if (primeNumber)
            {
            //we know that is only worth generating a fraction with a test case with following denominator
            //we know these can not  be divisible by 2 and 5...
            //System.out.println("is a prime number: " + m);
            primeLst.add(m);
            //noPrimeFactor[count] = m;
            }
            
        }
        
    }
    
    
     
    public boolean reducedNumerator(Long numerator, long divisor)
    {
        //System.out.println("Inside reducing numerator");
        //System.out.println("This is the divisor: " + divisor);
        if (divisor>numerator)
        {
            return false;
        }
        else
        {
            if (numerator%divisor==0)
            {
                successReducedNumerator = true;
                return successReducedNumerator;
            }
        }
        return false;
    }
    
    public boolean reducedDenominator(long denominator, long divisor)
    {
        //System.out.println("inside reducing denominator");
        //System.out.println("This is the divisor: " + divisor);
        
            if (denominator%divisor==0)
            {
                successReducedDenominator = true;
                return successReducedDenominator;
            }
            return false;
    }
    
    public void numeratorDenominatorReduction()
    {
        
    }
    
    long startPoint = 2;
    
    //if it is a terminating Decimal, not interested in checking if repetend...
    //not sure how to check if terminating decimal...
    //since can also have a longer decimal which terminate successfully such as 0.1875
    
    //If the denominator only has prime factors of 2 and/or 5, the fraction will terminate
    
    public boolean terminatingDecimal(long primeFactorCheck)
    {
        long counter=0;
        long denominatorDivisiblePrimeFactor=0;
        isTerminatingDecimal=true;
        List<Long> terminatingDecimalLst = new ArrayList<>();
        boolean primeFactorTwo=false;
        boolean primeFactorFive=false;
        
        
        Iterator<Long> f = primeLst.iterator();
        
        System.out.println("NOW IN TERMINATING DECIMAL CHECK: ");
        
        while (f.hasNext())
        {
            long item = f.next();
            counter++;
            //long item = f.hasNext();
            System.out.println(item + " in prime number list");
            
            
            if (item==2 && primeFactorCheck>=item)
            {
                if (primeFactorCheck%2==0)
                {
                    primeFactorTwo=true;
                }
            }
            
            if (item==5 && primeFactorCheck>=item)
            {
                if (primeFactorCheck%5==0)
                {
                    primeFactorFive=true;
                }
            }
            
            if (primeFactorFive || primeFactorTwo)
            {
                System.out.println("Terminating decimal with denominator: " + primeFactorCheck);
                return true;
            }
        }
        return false;
    }
        
        /*
        
        if (primeFactorCheck!=2 && primeFactorCheck!=5)
        {
            for (denominatorDivisiblePrimeFactor=startPoint;denominatorDivisiblePrimeFactor<2147483647;denominatorDivisiblePrimeFactor++)
            {
            //we know it can NOT be a terminating number if this satisfies
            if (denominatorDivisiblePrimeFactor%primeFactorCheck==0)
            {
                isTerminatingDecimal=false;
                return false;
                //break;
            }
            }
        }
        if (!isTerminatingDecimal)
        {
            //but now, we should really check it against %2 or %5 just incase....
            //since we know both these conditions need to satisfy and give terminating
            //We need to be careful that is has to performed on denominator that has been
            //reduced to lowest fraction part....
            
            //we know the value of the denominator is at the end of this method...
            //public void fraction(String[] testOne)
            //***IMPORTANT FLOW OF CODE **********
            
        //  fraction (but method call appears immediately). This method gets numerator and denominator in most
        //reduced form => 
        //generateTerminatingNonRepeatFractions    
        //This method identifies prime and non prime numbers
        //it passes prime number (lowest first) into method terminatingDecimal. 
        //Issue is in order to check
        //if terminating decimal, it is required to know the denominator in most reduced form...
        //however this is completed at bottom of the fraction part.=>
        //so terminatingDecimal can only be called once fraction method finished
        //terminatingDecimal =>
            
        System.out.println("Denominator: " + denominatorDivisiblePrimeFactor + " is terminating.");
        startPoint = denominatorDivisiblePrimeFactor;   //next time around, no need processing all
        //proessed denominstors for which we checked if terminating/non-terminating..
        
        terminatingDecimalLst.add(denominatorDivisiblePrimeFactor);
        }
        
        return true;
        */
        
    
    
    
     public void compareInputOutput()
    {
        
    }
    public void repetendLength()
    {
        
    }
    public boolean periodicNumber()
    {
        return true;
    }
    
    
    //this needs to be given a larger set to properly test primeFactorTwo and primeFactorFive check
    public void fraction(String[] testOne)
    {
        boolean improperFraction=false;
        String temp;
        long posTestOneDecimal=0;
        long posTestOneFraction;
        String numeratorOriginal="";
        String denominatorOriginal="";
        String decimalOriginal="";
        long denominatorIntoNumerator;
        String remainingFraction="";
        String decimalPortionOriginal="";
        
        generateTerminatingNonRepeatFractions();
        
        StringTokenizer st = new StringTokenizer (testOne[0], ",");
        
        
        
        while (st.hasMoreTokens())
        {
            
            
            temp= st.nextToken().toString();
            decimalOriginal=temp;
            
            posTestOneDecimal++;
            System.out.println("\n*** The Decimal presented: " + temp);
            decimalPortionOriginal = temp.substring(temp.indexOf("."));
        
        String fractionalPart = temp.substring((temp.indexOf(".")+1));
        String fractionalPartionWithDecimal = temp.substring((temp.indexOf(".")));
        long numerator = Long.valueOf(fractionalPart);
        String partialEquationTwo="";
        String fullEquationOne=temp;
        Long equationTwoA;
        boolean singleDigitrecurring=false;
        long denominator=0;
        long wholeNumberBeforeFractionLong=0;
        
        
        
        
      
        
        //logic for 0.777777777777777.. We know looking at YouTube video and own knowledge, that the fraction
        //will not reduce, I consider this the best option in order to maximise the length of the fractional part
        //and not stressing the executions..
        
         //note to perform logic on 0.242424, my main code is able to handle the situation
        //but there is still scope to handle this similar to 0.7777777
        //It is dealing with length of the the repetend, which was a critical part of my documentation
        //so it seems worthwhile applying this logic here.....
        //but ultimately to ensure we do not run into issues, the fractionalPart has to be long enough to test
        //length n of repetend since it requires 2 x n minimum...
        //otherwise will need to try and catch
        //0.2424 similar to 0.77777
        //Equation one =  0.2424    Equation Two = 24.2424
        //equation 2a = difference = 24
        //remainingFraction=24/99
        //issue that will occur is 24/99 can be reduced, but I have prevented my code from entering there
        //!singleDigitrecurring
        //if multiple digit re-curring, i need to send it to this area..
        //also issue is in which direction I want to take my code
        //are we accepting 0.242424    as 30303/125000 (which is the correct value).
        //so perhaps it is best not to perform the following below analysis with repetend of length 2...
        //I have a feeling also my precision will be compromised if I perform on anything other than single
        //digit wide recurring....
        //perhaps in these situations with multiple recurring, I can perform and obtain 24/99 (as below)
        //and also perform reduction on original numerator and denominator.
        //But this will break my code.. Requires thought..
        //My next area might be to explore other areas of my documentation..
        //I have generated so many prime numbers, it might be worth exploring decimal outputs with these...
         
        if(fractionalPart.length()>1)
        {
        do
        {
            System.out.println("HERE");
            
        
        if (fractionalPart.charAt(0)==fractionalPart.charAt(fractionalPart.length()-1))
        {
            singleDigitrecurring = true;
            System.out.println("same digit");
            fractionalPart=fractionalPart.substring(1);
            
            partialEquationTwo = partialEquationTwo + fractionalPart.charAt(0);
            
            
        }
        else
        {
            break;
        }
        //need minimum two required to allow indexing
        }while(fractionalPart.length()>1);
        }
        
        if (singleDigitrecurring)
        {
        String fullEquationTwo = fractionalPart.charAt(0) + "." + fractionalPart.charAt(0)+ partialEquationTwo;
        System.out.println("FULL EQUATION ONE: " + "x"+fullEquationOne+"x");
        System.out.println("FULL EQUATION TWO: " + "x"+fullEquationTwo+"x");
        
        equationTwoA = Long.valueOf(fullEquationTwo.charAt(0)) - Long.valueOf(fullEquationOne.charAt(0));
        System.out.println("FULL EQUATION TWO A: " + "x"+equationTwoA+"x");
        
        numerator = equationTwoA;
        denominator = 9;
        //denominator=9;
        remainingFraction = numerator + "/" + 9;
        
        System.out.println("Fraction of recurring: " + remainingFraction);
        }
        
        
         if (!singleDigitrecurring)
        {
        
        long multipliedBy;
        System.out.println("The fraction part: " + fractionalPart);
        
        multipliedBy=fractionalPart.length();
        
        
        long multipliedByInteger = Long.valueOf(multipliedBy);
        
        denominator = 1;
        long i=0;
    
        while (i<multipliedByInteger)
        {
            denominator = denominator * 10;
            i++;
        }
        
        //System.out.println("this is numerator: " + numerator);
        
        testOne[3]=String.valueOf(numerator);
        testOne[4]=String.valueOf(denominator);
        
        
        //System.out.println("this is denominator: " + denominator);
        
       
        for (divisor = denominator; divisor>=1; divisor--)
        {
            if (reducedNumerator(numerator,divisor) && reducedDenominator(denominator,divisor))
            {
                //System.out.println("*********This is divisor: " + divisor);
                denominator = denominator/divisor;
                numerator = numerator/divisor;
                successReducedDenominator=false;
                successReducedNumerator=false;
            }
            
        }
        
        System.out.println("******This is pos decimal: " + posTestOneDecimal);
        
        System.out.println("reduced numerator: " + numerator);
        System.out.println("reduced denominator: " + denominator);
        
        System.out.println("**** SECOND TOKENIZER **********");
        System.out.println("**** SECOND TOKENIZER **********");
        
        }
        
        
    posTestOneFraction=0;
    StringTokenizer st1 = new StringTokenizer (testOne[1], ",");
    while (st1.hasMoreTokens())
        {
            temp= st1.nextToken().toString();
            posTestOneFraction++;
            System.out.println("******This is pos Fraction part: " + posTestOneFraction);
            //System.out.println("CURENTLY IN TEMP: " + temp);
            
            
            if (posTestOneDecimal==posTestOneFraction)
            {
                ///temp= st1.nextToken().toString();
                System.out.println("Fraction presented is: " + temp );
                
                
                    //****************
            //numbers in this format
                //need to perform a tokenizer of these..
                //we know it will refer to correct location if the counter in here
                //matches other two Tokenizers...
                //delimter is a comma.
                //it then gets index of the - and rest digits after it
                //if no -,  then it can do whole tokenizer again looking for a /
                //first token is numerator, second is denominator
                //it can be compared against reducd numerator and reduced denominastor 
                //gives string after this
                
                //testOne[1]="3/6, 1/2, 1-1/4, 123/10000, 1/10000, 999/1000, 15/100, 86/100, 10-2/5, 23-1/2, 3/4";
            
            
            
            //temp= st2.nextToken().toString();
            
            
            if (temp.indexOf('-')!=-1)
            {
                numeratorOriginal = temp.substring((temp.indexOf('-')+1), temp.indexOf('/'));
                denominatorOriginal = temp.substring(temp.indexOf('/')+1);
                //testOne[1]="3/6, 1/2, 1-1/4, 123/10000, 1/10000, 999/1000, 15/100, 86/1
            }
            
            
            //if it does not find a  - in the String, it means no whole number
            //easier to extract
            if (temp.indexOf('-')==-1)
            {
                numeratorOriginal = temp.substring(0,temp.indexOf('/'));
                denominatorOriginal = temp.substring(temp.indexOf('/')+1);
                //can perform tokenizer again with /
            }
            
            
              //System.out.println("reduced numerator: " + numerator);
             //System.out.println("reduced denominator: " + denominator);
             
             //this is the first point that we know that end user has not provided
             //approximation of pi as decimal and fraction of pi
             //although we know that 22/7 is never going to give a terminating decimal
             //this is a valid exercise...
             
             //in this instance, it has only produced the fractional part in the exercise.
             //so it is impossible to compare the initial fractional state with that produced in calculation.
             //we can in practice convert the improper fraction to a proper fraction...
             
             System.out.println("***********");
             System.out.println(numeratorOriginal);
              System.out.println(denominatorOriginal);
              
              System.out.println("***********");
             
             
             long decimalOriginalLong = Long.valueOf(denominatorOriginal);
             long numeratorOriginalLong = Long.valueOf(numeratorOriginal);
             
             
             //improper fraction
             if (decimalOriginalLong<numeratorOriginalLong)
             {
                 System.out.println("FUK: " + numeratorOriginal);
                 System.out.println("FUK: " + denominatorOriginal);
                 
                 denominatorIntoNumerator = Long.valueOf(numeratorOriginal)/Long.valueOf(denominatorOriginal);
                 System.out.println("denom into numerator:" + denominatorIntoNumerator);
                 
                 long remainingNumerator = Long.valueOf(numeratorOriginal) - (Long.valueOf(denominatorOriginal) * denominatorIntoNumerator);
                 System.out.println("remiaing numerator: " + remainingNumerator);
                 
                 remainingFraction = remainingNumerator + "/" + denominatorOriginal;
                 System.out.println("remiaining fraction: " + remainingFraction);
                 System.out.println("Fraction provided in challenge is improper: " + temp);
                 //System.out.println(test);
                 
                 try
                 {
                     
                 String wholeNumberBeforeFraction = temp.substring(0,temp.indexOf("-"));
                 wholeNumberBeforeFractionLong = Long.valueOf(wholeNumberBeforeFraction);     
                 }
                 catch (StringIndexOutOfBoundsException e)
                 {
                     System.out.println("Improper fraction with no whole number in front");
                 }
                 
                 temp=remainingFraction;
                 numeratorOriginal = temp;
                 
                 //need to also add existing whole number that was there with the
                 //whole units generated from improper => proper fraction part conversion...
                 
                 System.out.println("Proper entire fraction is: " + (denominatorIntoNumerator+wholeNumberBeforeFractionLong) + "-" + remainingFraction);
                 improperFraction=true; 
             }
             
             
             if (numeratorOriginal.equals(String.valueOf(numerator)) && denominatorOriginal.equals(String.valueOf(denominator)))
             {
                 System.out.println("fraction provided in challenge is fully reduced: " + temp);
                 System.out.println("Original fraction" + "("+temp+")" + " provided is exact representation of the initial decimal conversion: " + decimalOriginal);
             }
             
             else
             {
                 System.out.println("Fraction provided in challenge: " + temp + " might not be correctly reduced " + "("+numerator+"/"+denominator+")");
                 
                 if (improperFraction)  
                 {
                 System.out.println("1Original reduced fraction provided " + remainingFraction + " is non- representation of the initial decimal conversion: " + decimalPortionOriginal);
                 improperFraction=false;
                 }
                 else
                 {
                     System.out.println("2Original reduced fraction provided " + temp + " is non- representation of the initial decimal conversion: " + fractionalPartionWithDecimal);
                     
                 }
                 
                 
            }
            
            //***************            break;
            }
        
    }
    
    singleDigitrecurring=false;
    terminatingDecimal(denominator);
        }
    
    }
    
    public RepeatDecimalFractions(String[] testOne)
    {
        this.testOne=testOne;
        fraction(testOne);
    }
}

public class Main
{
    public static void main(String[] args) {
        
        String[] testOne = new String[5];
        
       //There will be slightly different logic for 0.777777777777777 
       
        //This is my maximum length for a test scenario, it doesnt matter if I choose the single digit recurring
        //or the reduction route.
        testOne[0]="0.242424,0.1875325,0.7777777777777787777, 0.5, 1.25, 0.0123, 0.0001, 0.999, 0.15, 0.86, 10.4, 23.5, 0.75, 3.1425";
        
        testOne[1]="30303/125000,75013/400000,1-777/100,1/2,1-1/4,123/10000,1/10000,999/1000,15/100,86/100,10-2/5,23-1/2,3/4,22/7";
        testOne[2]="16";
    
        
        RepeatDecimalFractions rdf = new RepeatDecimalFractions(testOne);
        
        System.out.println("Welcome to Online IDE!! Happy Coding :)");
        
            
        
        
        String test = "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
        
    }
}