#include <iostream>
#include<cmath>
using namespace std;
int main() {
int x;
double a;
double b;
while(cin >> x ){//注意while处理多个case
for(int i = 0 ;i < x ; i++ ){
cin>>a;
a = a - 5000;
if(a <= 0){
b=0;
}else if( a < 3000){
b = a * 0.03;
}else if( a < 12000){
b = 3000 * 0.03 +(a - 3000) * 0.1 ;
}else if( a < 25000){
b = 3000 * 0.03 + 9000 * 0.1 + (a - 12000) * 0.2 ;
}else if( a < 35000){
b = 3000 * 0.03 + 9000 * 0.1 + 13000 * 0.2 + (a - 25000) * 0.25 ;
}else if( a < 55000){
b = 3000 * 0.03 + 9000 * 0.1 + 13000 * 0.2 + 10000 * 0.25 + (a - 35000) * 0.3 ;
}else if( a < 80000){
b = 3000 * 0.03 + 9000 * 0.1 + 13000 * 0.2 + 10000 * 0.25 + 20000 * 0.3 + (a - 55000) * 0.35 ;
}else {
b = 3000 * 0.03 + 9000 * 0.1 + 13000 * 0.2 + 10000 * 0.25 + 20000 * 0.3 + 25000 * 0.35 + (a - 80000) * 0.45 ;
}
cout<<round(b)<<endl;
//cout<<setiosflags(ios::fixed)<<setprecision(0)<<b<<endl;
}
//cout<< round(b)<<endl;
}
return 0;
}
/*
5
5000
15000
50000
8025
10001
0
790
9090
93
290
*/