#include #include #include #include #include #define rep(i,n) for(i=0; i> a #define out(a,b) cout << a << b using namespace std; using lint = long long; lint an(int n, int k, int m){ lint x=k%m; if(x> x(t, vector(3)); rep(i,t){ rep(j,3){ in(n); x[i][j]=n; } } rep(i,t){ out(an(x[i][0],x[i][2],x[i][1]),endl); } return 0; }