/** * @FileName a.cpp * @Author kanpurin * @Created 2020.10.16 21:54:35 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int a;cin >> a; if (a % 3 == 0) { puts("YES"); } else { puts("NO"); } return 0; }