#include <stdio.h>
int main()
{
int n, r, b, m, i, c = 0;
for (n = 3; c < 99; n += 2)
{
r = 1;
b = 2;
for (i = n; i; i /= 2)
{
if (i & 1)
r = r * b % n;
if (b * b < b)
return 1;
b = b * b % n;
}
if (r != 2)
continue;
for (i = n / 4 | 1; n % i; i -= 2);
if (i > 1)
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpCnsKICBpbnQgbiwgciwgYiwgbSwgaSwgYyA9IDA7CiAgZm9yIChuID0gMzsgYyA8IDk5OyBuICs9IDIpCiAgewogICAgciA9IDE7CiAgICBiID0gMjsKICAgIGZvciAoaSA9IG47IGk7IGkgLz0gMikKICAgIHsKICAgICAgaWYgKGkgJiAxKQogICAgICAgIHIgPSByICogYiAlIG47CiAgICAgIGlmIChiICogYiA8IGIpCiAgICAgICAgcmV0dXJuIDE7CiAgICAgIGIgPSBiICogYiAlIG47CiAgICB9CiAgICBpZiAociAhPSAyKQogICAgICBjb250aW51ZTsKCiAgICBmb3IgKGkgPSBuIC8gNCB8IDE7IG4gJSBpOyBpIC09IDIpOwogICAgaWYgKGkgPiAxKQogICAgICBwcmludGYoIiVkICVkXG4iLCArK2MsIG4pOwogIH0KICByZXR1cm4gMDsKfQo=