#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair pii; typedef unsigned long long ull; typedef long long ll; typedef vector vi; #define xx first #define yy second #define rep(i, a, n) for (int i = a; i < n; i++) #define sa(n) scanf("%d", &(n)) #define vep(c) for(decltype((c).begin()) it = (c).begin(); it != (c).end(); it++) const int mod = int(1e4) + 7, INF = 0x3fffffff, maxn = 1e5 + 12; bool m2(string x) { return (x[x.size() - 1] - '0') % 2 == 0; } bool m3(string x) { int ret = 0; for (int i = 0; i < x.size(); i++) { ret += x[i] - '0'; } return ret % 3 == 0; } bool m5(string x) { return (x[x.size() - 1] - '0') == 0 || (x[x.size() - 1] - '0') == 5; } int main(void) { string str; while (cin >> str) { if (m2(str) || m3(str) || m5(str)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; } /* int n, h, v[2222]; double p; map, double> dp[2222][2222]; int getid(int x) { return lower_bound(v, v + n, x) - v + 1; } double dfs(int l, int r, int lf, int rf) { int li = getid(l), ri = getid(r); if (dp[li][ri].count(make_pair(lf, rf))) return dp[li][ri][make_pair(lf, rf)]; if (l > r) return 0; double ret = 0.0; //左边的树倒 ret += p * 0.5 * (min(h, v[l] - lf) + dfs(l + 1, r, v[l], rf)); int x = l + 1; while (v[x] < v[x - 1] + h && x <= r) x++; x--; ret += (1 - p) * 0.5 * (min(v[x] - v[l] + h, rf - v[l]) + dfs(x + 1, r, v[x] + h, rf)); //右边的树倒 ret += (1 - p) * 0.5 * (min(h, rf - v[r]) + dfs(l, r - 1, lf, v[r])); x = r - 1; while (v[x] > v[x - 1] - h && x >= l) x--; x++; ret += p * 0.5 * (min(v[r] - v[x] + h, v[r] - lf) + dfs(l, x - 1, lf, v[x] - h)); return dp[li][ri][make_pair(lf, rf)] = ret; } int main(void) { sa(n), sa(h); scanf("%lf", &p); rep (i, 0, n) sa(v[i]); sort(v, v + n); printf("%.15f\n", dfs(0, n - 1, -INF, INF)); return 0; }*/