#include #include #include using namespace std; bool IsPrime(uint64_t n) { if (n <= 3) return n > 1; if ((n&1) == 0 || n%3 == 0) return false; for (uint64_t x = 5, xsq = 5*5, xsqd = 11*11 - 5*5; xsq > 0 && xsq <= n; x += 6, xsq += xsqd, xsqd += (17*17-11*11) - (11*11-5*5)) if (n%x == 0 || n%(x+2) == 0) return false; return true; } int main() { char buf[100]; string s1, s2, s3, s4; int n1, n2, n3; cin >> s1 >> s2 >> s3; if (cin >> s4) { cout << 0 << endl; return 0; } n1 = atoi(s1.c_str()); n2 = atoi(s2.c_str()); n3 = atoi(s3.c_str()); sprintf(buf, "%d", n1); if (s1 != buf) { cout << 0 << endl; return 0; } sprintf(buf, "%d", n2); if (s2 != buf) { cout << 0 << endl; return 0; } sprintf(buf, "%d", n3); if (s3 != buf) { cout << 0 << endl; return 0; } if (n1%2 || n1 <= 3 || n1 > 1000000000) { cout << 0 << endl; return 0; } if (n1 != n2+n3) { cout << 0 << endl; return 0; } if (!IsPrime(n2)) { cout << 0 << endl; return 0; } if (!IsPrime(n3)) { cout << 0 << endl; return 0; } cout << 1 << endl; }