import java.io.*;

// Final Jeopardy Programming Problem
// Input: Our current winnings, followed by the winnings of each
//        of our two competitors (contestants 2 & 3)
// Output: The amount we should wager, according the rules of the
//         problem statement.

public class Jeopardy
{
  public static void main( String[] args ) throws Exception
  {
    // get input from user
    System.out.println( "Welcome to the Final Jeopardy round!" );
    int[] dollars = new int[3];  // current winnings of the 3 contestants
    for( int i = 0; i < 3; i++ )
      dollars[i] = promptAmount( i+1 );

    // which of the other contestants have more money?
    int larger = dollars[1];
    if( dollars[2] > larger ) larger = dollars[2];

    // decide and output what our wager should be
    if( larger >= dollars[0] )
      System.out.println(
        "You're not in the lead, and should wager your entire $" +
        dollars[0] + ".");
    else if( dollars[0] > 2*larger )
      System.out.println( "You can comfortably wager $" +
        (dollars[0] - 2*larger - 1) + "." );
    else
      System.out.println( "You should wager $" +
        (2*larger - dollars[0] + 1) + "." );
  }

  private static int promptAmount(int contestant) throws Exception
  {
    BufferedReader br = new BufferedReader(
                        new InputStreamReader( System.in ) );
    int amount = 0;
    while( true )
    {
      if( contestant == 1 )
        System.out.print( "Enter your current winnings: " );
      else
        System.out.print( "Enter the current winnings of contestant #" +
                          contestant + ": " );
      amount = Integer.parseInt( br.readLine() );
      if( amount >= 0 ) break;
      System.out.println( "Please enter a nonnegative integer..." );
    }
    return amount;
  }
}
