#include <iostream>
#include <cstring>
using namespace std;
const int N = 10010;
int t, n;
int v[3] = {150, 200, 350}, w[3] = {150, 200, 350};
int f[N];
int max(int a, int b)
{
return a > b ? a : b;
}
int main()
{
cin >> t;
while (t -- )
{
memset(f, 0, sizeof(f));
cin >> n;
for (int i = 0; i < 3; i ++ )
for (int j = v[i]; j <= n; j ++ )
f[j] = max(f[j], f[j - v[i]] + w[i]);
cout << n - f[n] << endl;
}
return 0;
}