#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,i=100;
	while(i<=199){
		if(i%3==2&&i%5==3&&i%7==5){
			cout<<i;
			break;
		}
		i++;
	} 
	
	
}


/**************************************************************
	Problem: 1017
	User: 15159808820
	Language: C++
	Result: Accepted
	Time:5 ms
	Memory:2072 kb
****************************************************************/