#include<bits/stdc++.h>
using namespace std;
int main(){
int kkksc03,count=0;
cin>>kkksc03;
for(int i=1;i<=2;i++){
for(int j=0;j<=9;j++){
for(int k=0;k<=9;k++){
for(int l=0;l<=9;l++){
for(int m=0;m<=9;m++){
if((i*100+j*10+k)%kkksc03==0&&(j*100+k*10+l)%kkksc03==0&&(k*100+l*10+m)%kkksc03==0){
cout<<i<<j<<k<<l<<m<<endl;
count++;
}
}
}
}
}
}
if(300%kkksc03==0&&0%kkksc03==0){
cout<<"30000";
count++;
}
if(count=0)cout<<"No";
return 0;
}