#include<bits/stdc++.h>
using namespace std;
int main(){
for(int i=0;i<1000;i++){
if(i%3==0){
if(i/100==5||i%100/10==5||i%10==5){
cout<<i<<endl;
}
}
}
}
/**************************************************************
Problem: 1059
User: zhengzihao
Language: C++
Result: Accepted
Time:10 ms
Memory:2072 kb
****************************************************************/