#include using namespace std; int main(){ int64_t N; cin >> N; int64_t ans = N; while(ans < 9){ ans %= 9; } if(ans % 2 == 0) cout << "Yes" << endl; else cout << "No" << endl; }