import java.io.*; 
  
public class KeepingScore 
{ 
  static int additionProblem(int topNumber, int bottomNumber) throws Exception 
  { 
    int result = 0; // 0 is the code for incorrect 
  
    BufferedReader cin; 
    cin = new BufferedReader(new InputStreamReader(System.in)); 
  
    int userAnswer; 
    System.out.print("\n\n\n      " + topNumber + " + " + bottomNumber + " = "); 
    userAnswer = new Double(cin.readLine()).intValue(); 
  
    int theAnswer = topNumber + bottomNumber; 
    if (theAnswer == userAnswer) 
    { 
      System.out.println("      Correct!"); 
      result = 1; // 1 is the code for correct 
    } // if 
    else 
      System.out.println("      Very good, but a better answer is " + theAnswer); 
  
    return result; 
  } // additionProblem 
  
  public static void main(String[] argv) throws Exception 
  { 
    int score = 0; 
    score += additionProblem((int)(10 * Math.random()), (int)(10 * Math.random())); 
    score += additionProblem((int)(10 * Math.random()), (int)(10 * Math.random())); 
    score += additionProblem((int)(10 * Math.random()), (int)(10 * Math.random())); 
    score += additionProblem((int)(10 * Math.random()), (int)(10 * Math.random())); 
    score += additionProblem((int)(10 * Math.random()), (int)(10 * Math.random())); 
  
    System.out.println("\n      TOTAL SCORE: " + score + " out of 5"); 
  } // main 
} // public class 
