#!/usr/bin/env python3
import re
import sys

def valid_even(x):
    return x > 2 and x % 2 == 0

def valid_prime(p):
    if p < 2:
        return False

    for x in range(2, p):
        if x * x > p:
            break
        elif p % x == 0:
            return False

    return True

def check(vals):
    return all(0 <= x <= 10**9 for x in vals) \
            and valid_even(vals[0]) \
            and vals[0] == vals[1] + vals[2] \
            and all(valid_prime(p) for p in vals[1:])

def main():
    data = sys.stdin.read()
    match = re.fullmatch(r'\s*([1-9]\d*)\s+([1-9]\d*)\s+([1-9]\d*)\s*', data)

    valid = False
    if match is not None:
        vals = [int(match.group(k)) for k in range(1, 4)]
        valid = check(vals)

    print(1 if valid else 0)


if __name__ == "__main__":
    main()
