#include<bits/stdc++.h>
using namespace std;
int main()
{
int k;
int ans;
int sub1, sub2, sub3;
cin >> k;
for(int i = 10000; i <= 30000; i++)
{
sub1 = i / 100;
sub2 = i % 10000 / 10;
sub3 = i % 1000;
if((sub1 % k == 0) && (sub2 % k == 0) && (sub3 % k == 0))
{
cout << i << endl;
ans = 1;
}
}
if(ans != 1)
{
cout << "No";
}
return 0;
}
//大佬们帮忙看看是哪里出了问题