{"raw_statement":[{"iden":"problem statement","content":"There are integers with $N$ different values written on a blackboard. The $i$\\-th value is $A_i$ and is written $B_i$ times.\nYou may repeat the following operation as many times as possible:\n\n*   Choose two integers $x$ and $y$ written on the blackboard such that $x+y$ is prime. Erase these two integers.\n\nFind the maximum number of times the operation can be performed."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 100$\n*   $1 \\leq A_i \\leq 10^7$\n*   $1 \\leq B_i \\leq 10^9$\n*   All $A_i$ are distinct.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ \n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\vdots$\n$A_N$ $B_N$"},{"iden":"sample input 1","content":"3\n3 3\n2 4\n6 2"},{"iden":"sample output 1","content":"3\n\nWe have $2 + 3 = 5$, and $5$ is prime, so you can choose $2$ and $3$ to erase them, but nothing else. Since there are four $2$s and three $3$s, you can do the operation three times."},{"iden":"sample input 2","content":"1\n1 4"},{"iden":"sample output 2","content":"2\n\nWe have $1 + 1 = 2$, and $2$ is prime, so you can choose $1$ and $1$ to erase them. Since there are four $1$s, you can do the operation twice."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}