BFS,初始状态为1,然后每一个m,10m和10m+1都也是符合要求的m
//例题9.2 Find The Multiple
int BFS(int n){
queue<long long>q;
q.push(1);
while(!q.empty()){
long long out=q.front();
if(out%n==0)return out;
q.pop();
q.push(10*out);
q.push(10*out+1);
}
return -1;
}
int main(){
int n;
scanf("%d",&n);
long long m=BFS(n);
cout<<m<<endl;
return 0;
}