
#include<iostream>
#include <string.h>
#include<stdio.h>
#include <math.h>

using namespace std;

int main(){
	int N;
	cin >> N;

	if ((N + 3) % 10 == 0 || (N + 30) % 100 == N % 10 || (N + 300) % 1000 == N % 100 ) cout << "Yes" << endl;
	else cout << "No" << endl;
	
return 0;
}
