2021 ICPC North America Division Championships

Start

2021-04-22 15:30 AKDT

2021 ICPC North America Division Championships

End

2021-04-22 19:00 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -220 days 16:17:07

Time elapsed

3:30:00

Time remaining

0:00:00

Problem M
You Be the Judge!

Congratulations! You are now the judge of a programming contest! You’ve been put in charge of a problem, and since your problem may not have unique correct output, you’ve got to write an output checker for it.

Your problem is called “Good as Goldbach”, and it’s based on the Goldbach Conjecture (that any positive even integer greater than $3$ can be expressed as the sum of two primes). A solving program’s output should have three numbers separated by whitespace: First, a positive even integer greater than $3$ and less than or equal to $10^9$, and then two (positive) prime numbers which sum to the even number.

You must write a checker for this problem. Your checker should take the output of a contestant’s program, and determine whether or not it could possibly be correct. That is, determine if the contestant’s output consists only of three tokens separated by whitespace, the first of which is a positive even integer greater than $3$ and less than or equal to $10^9$, and the next two are positive prime integers which sum to the first. The integers should be in base ten, with no signs or leading zeros. Any amount of white space anywhere except within an integer, including blank lines, is OK. Any other output, extra characters, missing numbers, etc. should be considered incorrect.

Input

The input will consist of from $0$ to $1\, 000$ lines. Each line consists of from $0$ to $100$ printable ASCII characters (with codes 32 through 126), or tabs.

Output

Output a single integer, which is $1$ if the input could possibly be a correct output for the “Good as Goldbach” problem, or $0$ if the input could not possibly be a correct output for the “Good as Goldbach” problem.

Sample Input 1 Sample Output 1
10 3 7
1
Sample Input 2 Sample Output 2
10   3   7
1
Sample Input 3 Sample Output 3
314
159 265
358
0
Sample Input 4 Sample Output 4
22 19 3
1
Sample Input 5 Sample Output 5
   60
  
  29
  
      31
          
          
          
          
1
Sample Input 6 Sample Output 6
fred!
sam!
george!
0