#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
struct Student {
string name;
int age, score;
} a[N];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].name >> a[i].age >> a[i].score;
a[i].age++, a[i].score = a[i].score / 5 * 6;
if (a[i].score > 600) a[i].score = 600;
cout << a[i].name << " " << a[i].age << " " << a[i].score << endl;
}
return 0;
}