#include<bits/stdc++.h>
using namespace std;
const double PI=acos(-1);
#define int long long
#define double long double
#define endl '\n'
#define sqrt sqrtl
#define rep(i,a,b) for(int i=a;i<=b;i++)
int gcd (int a ,int b){
return b ? gcd ( b , a % b ) :a;
}
const int N=205;
double f[N][N];
void solve(){
int n,m;cin>>n>>m;
rep(i,1,n){
rep(j,0,m){
f[i][j]=0;
}
}
rep(i,1,n){
double a,b,c;cin>>a>>b>>c;
rep(j,0,m){
f[i][j]=f[i-1][j];
if(j-(int)b>=0)
f[i][j]=max(f[i][j],f[i-1][(int)(j-b)]+max(0.3*a,a-0.004*a*(j)-50*c));
}
}
cout<<f[n][m]<<endl;
}
signed main(){
// ios::sync_with_stdio(false);
// cin.tie(0),cout.tie(0);
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
}