#include <iostream>
using namespace std;
int main() {
int k,p;
cin >> k;
for (int num = 10000; num <= 30000; num++) {
int a = num / 100;
int b = (num % 10000) / 10;
int c = num % 1000;
if (a % k == 0 && b % k == 0 && c % k == 0) {
cout << num << endl;
p=1;
}
}
if(p==0) cout<<"No";
return 0;
}