https://www.acmicpc.net/problem/15953
using System;
class Program
{
static void Main() {
int n=int.Parse(Console.ReadLine());
for(int i=0;i<n;i++){
string[] s=Console.ReadLine().Split(' ');
int a=int.Parse(s[0]);
int b=int.Parse(s[1]);
int na=0;
int nb=0;
if(a==0) na=0;
else if(a==1) na=5000000;
else if(a<=3) na=3000000;
else if(a<=6) na=2000000;
else if(a<=10) na=500000;
else if(a<=15) na=300000;
else if(a<=21) na=100000;
if(b==0) nb=0;
else if(b==1) nb=5120000;
else if(b<=3) nb=2560000;
else if(b<=7) nb=1280000;
else if(b<=15) nb=640000;
else if(b<=31) nb=320000;
Console.WriteLine(na+nb);
}
}
}