#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; const ll half=(mod+1)/2; const double PI=acos(-1); int ct=0; int col[mn]; int p[mn],nd[mn]; vectorrel[mn]; vectorg[mn],rg[mn],rnd[mn]; vectorv; vector >ans[2]; vectorrd[2]; 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"); else printf("NO"); }