#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; auto f = [&](int v){ ll md = (v * 1'111'111'110ll + 9) % n; string ans(9, '0' + v); if(md == 0){ cout << ans << '9' << '\n'; exit(0); } for(int i = 11; i <= 2000; i++){ ans += '0' + v; md *= 10; md += 9; md %= n; if(md == 0){ cout << ans << '9' << '\n'; exit(0); } } }; for(int i = 1; i <= 9; i++) f(i); }