#include "bits/stdc++.h" using namespace std; typedef pairpii; typedef long long ll; typedef pair pll; typedef __int128 lll; typedef vector vi; typedef vector vl; mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); const int mn=3e5+10; const ll inf=0x3f3f3f3f3f3f3f3f; const ll mod=1e9+7; int main(){ #ifdef LOCAL freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); freopen("error.txt","w",stderr); #endif cin.tie(0); cin.sync_with_stdio(0); ll n; cin>>n; if(n%3==0)printf("YES\n"); else printf("NO\n"); }