My simple method gives TLE can someone help me


#1
string Solution::multiple(int A) {
    if(A==1){return "1";}
    queue<long long unsigned> q;
    q.push(1);
    while(true){
        long long unsigned s = q.front();
        q.pop();
        string t  = to_string(s);
        if(s%A==0){return t;}
        else{
            int i;
            istringstream(t+"0") >> i;
            q.push(i);
            istringstream(t+"1") >> i;
            q.push(i);
        }
    }
}