#include using namespace std; #define int __int128 map > factored; const int MOD = 1ll<<41; int PHI = MOD / 2; int frac[1111111]; int bpow(int a,int b){ return b?bpow(a*a%MOD,b/2)*(b&1?a:1)%MOD:1; } struct Number{ int twos; int val; Number(){ val = 1; twos = 0; } Number(int n){ twos = val = 0; while( n % 2 == 0 ) n /= 2, twos++; val = n; val %= MOD; } int v(){ if( twos >= 21 ) return 0; return val * (1<> T; while(T--){ signed A,B,C; cin >> A >> B >> C; cout << (signed)solver(A,B,C) << endl; } }