#include using namespace std; int main(){ int A; cin >> A; if (A % 3 == 0){ cout << "YES" << endl; } else { cout << "NO" << endl; } }