#include<bits/stdc++.h>
using namespace std;
int main() {
int k;
cin>>k;
bool flag=false;
for(int i=10000; i<=30000; i++) {
int temp=i;
int a1=temp/100;
if(a1%k!=0) {//取前三位
continue;
}
int a2=(temp/10)%1000;//中间三位
if(a2%k!=0) {
continue;
}
int a3=temp%1000;//最后三位
if(a3%k!=0) {
continue;
}
cout<<i<<endl;
flag=true;
}
if(flag==false) {
cout<<"No";
}
}