/************************************************************** User: error408 Language: C/C++ School: SSDUT Saying: Do one thing at a time,and do well. ****************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #pragma comment(linker,"/STACK:102400000,102400000") #define clr(s,x) memset((s),(x),sizeof(s)) #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define lowbit(x) (x&(-x)) #define PB push_back #define RL(N) scanf("%I64d",&N) #define RLL(L,R) (RL(L),RL(R)) #define lch(x) x<<1 #define rch(x) x<<1|1 #define lrt rt<<1 #define rrt rt<<1|1 typedef long long LL; typedef unsigned int uint; typedef unsigned long long ULL; typedef vector vint; typedef vector vstring; /************************************END DEFINE*********************************************/ const int maxn = 1e5 + 100; int n; char s[20]; LL a,b; int day[12]={31,28,31,30,31,30,31,31,30,31,30,31}; bool check(int x){ if((x%4==0 && x%100!=0) || x%400==0)return true; return false; } int main() { int t; cin>>t; while(t--){ cin>>n; cin>>a>>b; LL ans = 0; for(int i=0;i=1980 && mm>=1 && mm <=12){ if(!check(nn))day[1]=28; else day[1]=29; if(dd>=1 && dd<=day[mm-1])ans+=a; else ans+=b; } else ans+=b; } cout<