//KAVISH DWIVEDI
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<string>
#include<list>
#include<cstring>
#include<cmath>
#include<iomanip>
#include<cstdlib>
#include<climits>
#include<utility>
#define D(i) cout<<"Reached Here "<<i<<endl
#define MOD 1000000007
#define eps 10e-5
#define ll long long
#define ull unsigned long long
#define PI 3.14159265
using namespace std;
int main(){
int n;
cin>>n;
int a[6];
int sum,mm;
while(n--){
sum=0;
for(int i=0;i<6;i++)
cin>>a[i];
int dp[201];
for(int i=0;i<201;i++)
dp[i]=INT_MAX;
dp[0]=0;
for(int i=1;i<201;i++){
for(int j=0;j<6;j++){
if(i-a[j]>=0){
dp[i]=min(dp[i],dp[i-a[j]]+1);
}
}
}
for(int i=199;i;i--){
for(int k=0;k<6;k++){
if(a[k]+i<=200){
dp[i]=min(dp[i],dp[a[k]+i]+1);
}
}
}
/*for(int i=0;i<101;i++){
cout<<i<<" = "<<dp[i]<<endl;
}*/
mm=dp[0];
for(int i=1;i<101;i++){
sum+=dp[i];
mm=max(mm,dp[i]);
}
//cout<<setiosflags(ios::fixed)<<setprecision(2)<<4.9890<<endl;
printf("%.2f %d\n",sum/100.00,mm);
//cout<<setiosflags(ios::fixed)<<setprecision(4)<<sum/100.00<<" "<<mm<<endl;
}
return 0;
}
Ly9LQVZJU0ggRFdJVkVESQojaW5jbHVkZTxpb3N0cmVhbT4KI2luY2x1ZGU8Y3N0ZGlvPgojaW5jbHVkZTxhbGdvcml0aG0+CiNpbmNsdWRlPG1hcD4KI2luY2x1ZGU8c2V0PgojaW5jbHVkZTx2ZWN0b3I+CiNpbmNsdWRlPHN0cmluZz4KI2luY2x1ZGU8bGlzdD4KI2luY2x1ZGU8Y3N0cmluZz4KI2luY2x1ZGU8Y21hdGg+CiNpbmNsdWRlPGlvbWFuaXA+CiNpbmNsdWRlPGNzdGRsaWI+CiNpbmNsdWRlPGNsaW1pdHM+CiNpbmNsdWRlPHV0aWxpdHk+CiNkZWZp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