import java.util.*;

public class Verifier
{
    public static final String EXAMPLE1 = "example1.txt";
    public static final long EXAMPLE1_RESULT = 71;
    public static final String EXAMPLE2 = "example2.txt";
    public static final long EXAMPLE2_RESULT = 51;
    public static final String EXAMPLE3 = "example3.txt";
    public static final long EXAMPLE3_RESULT = 26;
    public static final String EXAMPLE4 = "example4.txt";
    public static final long EXAMPLE4_RESULT = 437;
    public static final String EXAMPLE5 = "example5.txt";
    public static final long EXAMPLE5_RESULT = 12240;
    public static final String EXAMPLE6 = "example6.txt";
    public static final long EXAMPLE6_RESULT = 13632;

    public Verifier (boolean debug)
    {
        _debug = debug;
    }

    public boolean verify ()
    {
        Vector<String> data = Util.loadData(EXAMPLE1);
        MathsParser p = new MathsParser(_debug);
        Long result = p.parse(data);

        if (result == EXAMPLE1_RESULT)
        {
            data = Util.loadData(EXAMPLE2);

            result = p.parse(data);

            if (result == EXAMPLE2_RESULT)
            {
                data = Util.loadData(EXAMPLE3);

                result = p.parse(data);

                if (result == EXAMPLE3_RESULT)
                {
                    data = Util.loadData(EXAMPLE4);

                    result = p.parse(data);

                    if (result == EXAMPLE4_RESULT)
                    {
                        data = Util.loadData(EXAMPLE5);

                        result = p.parse(data);

                        if (result == EXAMPLE5_RESULT)
                        {
                            data = Util.loadData(EXAMPLE6);

                            result = p.parse(data);

                            if (result == EXAMPLE6_RESULT)
                                return true;
                            else
                                System.out.println("Incorrect value for "+EXAMPLE6+" "+result);
                        }
                        else
                            System.out.println("Incorrect value for "+EXAMPLE5+" "+result);
                    }
                    else
                        System.out.println("Incorrect value for "+EXAMPLE4+" "+result);
                }
                else
                    System.out.println("Incorrect value for "+EXAMPLE3+" "+result);
            }
            else
                System.out.println("Incorrect value for "+EXAMPLE2+" "+result);
        }
        else
            System.out.println("Incorrect value for "+EXAMPLE1+" "+result);

        return false;
    }

    private boolean _debug;
}
@@ -143,17 +143,18 @@
 ESULT = 
-7
+23
 1;%0A    p
@@ -362,17 +362,17 @@
 ESULT = 
-2
+4
 6;%0A    p
@@ -475,11 +475,12 @@
 T = 
-437
+1445
 ;%0A  
@@ -586,12 +586,13 @@
 T = 
-1224
+66906
 0;%0A 
@@ -699,13 +699,13 @@
 T = 
-13632
+23340
 ;%0A%0A 

Update Verifier.java