#include <iostream> #include <cmath> #include <cstring> using namespace std; int a[3] = {150, 200, 350}; int f[10001]; int main() { //freopen("1.txt", "r", stdin); int t; cin >> t; while(t--) { int n; cin >> n; memset(f, 0, sizeof(f)); for(int i = 0; i < 3; i++) { for(int j = a[i]; j <= n; j++) { if(f[j - a[i]] + a[i] <= n && f[j - a[i]] + a[i] > f[j]) f[j] = f[j - a[i]] + a[i]; } } cout << n - f[n] << endl; } return 0; }