#include <bits/stdc++.h>
using namespace std;
int main(){
int k;
cin >> k;
bool s = 1;
for (int i = 10000;i <= 30000;i ++){
int a = i % 1000,b = i % 10000 / 100,c = i / 10000;
if (a % k == 0 and b % k == 0 and c % k == 0){
s = 0;
cout << i << ' ';
}
}
if (s == 1)cout << "No";
return 0;
}