Ecological Premium
#include<bits/stdc++.h> using namespace std; int main() { int n,m; unsigned long long int a,b,c,sum; while((scanf("%d",&n)!=EOF)) { for(int i=0;i<n;i++) { cin>>m; sum=0; for(int i=0;i<m;i++) { cin>>a>>b>>c; sum+=a*c; } cout<<sum<<endl; } } return 0; }