#include "iostream" using namespace std; int main() { int testcase; double s1, s2, ans, d, t; cin >> testcase; while (testcase--) { cin >> d >> t; s1 = s2 = ans = 0; if (d <= 3) { s1 = 10 + 1 + 2*t/5; s2 = 11 + 2.5*t/4; } else if (d > 3 && d <= 10) { s1 = 10 + 1 + 2*t/5 + (d-3)*2; s2 = 11 + 2.5*t/4 + (d-3)*2.5; } else { s1 = 10+ 1 + 2*t/5 + 7*2 + (d-10)*3; s2 = 11 + 2.5*t/4 + 7*2.5 + (d-10)*3.75; } s1 = (int)(s1 + 0.5); s2 = (int)(s2 + 0.5); ans = s2 - s1; cout << ans << endl; } }