#include <stdio.h>
#define MAX_N 1000000
#define IS_PRIME 0
#define NOT_PRIME 1
int main(void)
{
int primeTable[MAX_N] = {1, 1};
int i, j;
for (i = 2; i < MAX_N; ++i)
if (primeTable[i] == IS_PRIME)
for (j = i; j < MAX_N; j += i)
primeTable[j] = NOT_PRIME;
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgojZGVmaW5lIE1BWF9OICAgICAgICAgICAxMDAwMDAwCgojZGVmaW5lIElTX1BSSU1FICAgICAgICAwCiNkZWZpbmUgTk9UX1BSSU1FICAgICAgIDEKCmludCBtYWluKHZvaWQpCnsKICAgIGludCBwcmltZVRhYmxlW01BWF9OXSA9IHsxLCAxfTsKICAgIGludCBpLCBqOwogICAgZm9yIChpID0gMjsgaSA8IE1BWF9OOyArK2kpCiAgICAgICAgaWYgKHByaW1lVGFibGVbaV0gPT0gSVNfUFJJTUUpCiAgICAgICAgICAgIGZvciAoaiA9IGk7IGogPCBNQVhfTjsgaiArPSBpKQogICAgICAgICAgICAgICAgcHJpbWVUYWJsZVtqXSA9IE5PVF9QUklNRTsKCiAgICByZXR1cm4gMDsKfQo=