#include #include using namespace std; #define SIZE 1000000 #define INF 999999999 char num[40]; int main() { while (cin >> num) { int len = strlen(num); int sum = 0; for (int i = 0; i < len; i++) { sum += num[i] - '0'; } if ((num[len - 1] - '0') == 0) { cout << "YES" << endl; } else if ((num[len - 1] - '0') % 5 == 0) { cout << "YES" << endl; } else if ((num[len - 1] - '0') % 2== 0) { cout << "YES" << endl; } else if (sum % 3 == 0) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }