#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
#define INF 0x3f3f3f
int gcd(int a, int b) {return b==0 ? a:gcd(b,a%b);}
int n;
int flag;
unsigned long long ans;
void dfs(unsigned long long x, int step)
{
if(flag||step>19) return;
if(x%n==0){
flag = 1;
ans = x;
return;
}
dfs(x*10,step+1);
dfs(x*10+1,step+1);
}
int main()
{
while(~scanf("%d", &n))
{
if(n==0) break;
flag = 0;
dfs(1,1);
printf("%llu\n", ans);
}
return 0;
}
01-22
2547
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-08
08-19
08-19