#include <bits/stdc++.h>
#define int long long
using namespace std;
int t,n,a,d;
signed main(){
ios::sync_with_stdio(0);
cin>>t;
while(t--){
cin>>n>>a>>d;
if(d%2==1){
cout<<0<<endl;
continue;
}
int las=a+(n-1)*d;
int num=las-a-n+1;
cout<<num<<endl;
}
return 0;
}