Problem:
Score : 100 points

Problem Statement

Iroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.

To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Constraints

1≦A,B,C≦10

Input

The input is given from Standard Input in the following format:

A B C

Output

If it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.

Sample Input 1

5 5 7

Sample Output 1

YES

Using three phrases of length 5, 5 and 7, it is possible to construct a Haiku.

Sample Input 2

7 7 5

Sample Output 2

NO

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

long long table[1000000] = { 0 };

long long fact(long long n);

int main() {
	long long h, w, a, b;
	scanf("%lld %lld %lld %lld", &h, &w, &a, &b);

	long long fh_a = fact(h - a), fa = fact(a);
	long long sum = 0;

	for (long long i = b + 1; i <= w; i++) {
		sum = (sum + (((fact(h - a + i) / (fh_a * fact(i))) % 1000000007LL) * 
			((fact(a + w + 1 - i) / (fa + fact(w + 1 - i))) % 1000000007LL)) % 1000000007LL) % 1000000007LL;
		
	}

	printf("%lld\n", sum);

	return 0;
}

long long fact(long long n) {
	if (table[n - 1] != 0)return table[n - 1];
	else if (n == 1) {
		table[0] = 1;
		return 1;
	}
	else {
		table[n - 1] = fact(n - 1);
		return table[n - 1];
	}
}