#include <bits/stdc++.h>

using namespace std;

int profit(int b, int s, int c) 
{
        int profits;
        if( b < 15 && s < 15 && c < 15)
        {
            profits = 4;
            
        }
        else if(b < 260 && s < 260 && c < 260 )
        {
            profits = 143;
        }
        else
        {
            profits = 69;
        }
        
        return profits;
}

int main()
{
    int t,i;
    cin >> t;
    int a,b,c;
    int final_profits[3];
    for(i=0 ; i < t ; i++)
    {
        cin >> a;
        cin >> b;
        cin >> c;
        final_profits[i] = profit(a,b,c);
       
    }
    for(i=0;i<t;i++)
    {
        cout<<final_profits[i]<<endl;
    }
    
    return 0;
}