This problem is a programming version of Problem 196 from projecteuler.net
Build a triangle from all positive integers in the following way:
Each positive integer has up to eight neighbours in the triangle.
A set of three primes is called a if one of the three primes has the other two as neighbours in the triangle.
For example, in the second row, the prime numbers and are elements of some prime triplet.
If row is considered, it contains two primes which are elements of some prime triplet, i.e. and .If row is considered, it contains only one prime which is an element of some prime triplet: .
Define as the sum of the primes in row which are elements of any prime triplet.Then and .
You are given that .
The only line of each test file contains exactly two integers separated by a single space: and .
Output exactly one number that equals to .
Sample Input 0
Sample Output 0
Sample Input 1
Sample Output 1