#include #include using namespace std; string N,K; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T;cin>>T; for(;T--;) { cin>>N>>K; long ans=K.size(); for(int i=0;iN); else if(L+R9<=N)ans+=p; else { long t=0; for(int j=i+1;j