#include using namespace std; int main() { int n; cin >> n; string a = "Yes"; if(n % 6) a = "NO"; cout << a << endl; }