ll@T;rep(T){ll@N,C=1d3,r=N%C+1,m,L;VI a(3C);string@S;L=S.size();m=stoll(S.substr(0,L-4)+S.substr(L-3));REP(i,2C)a[i+1]=a[i]+((i*m+C-1)/C*C