dice=[]
money1=[]
n = int(input())
money=0
money = int(money)
for i in range(n):
a, b, c, d = map(int, input().split())
dice.append(a)
dice.append(b)
dice.append(c)
dice.append(d)
if(a==b==c==d):
money=50000+a*5000
money1.append(money)
elif(a==b==c):
money=10000+a*1000
money1.append(money)
elif(a==b==d):
money=10000+a*1000
money1.append(money)
elif(b==c==d) :
money=10000+b*1000
money1.append(money)
elif(a==b and c==d):
money=2000+a*500+c*500
money1.append(money)
elif(a==c and b==d):
money=2000+a*500+b*500
money1.append(money)
elif(a==d and b==c):
money=2000+a*500+b*500
money1.append(money)
elif(a==b):
money=1000+a*100
money1.append(money)
elif(a==c):
money=1000+a*100
money1.append(money)
elif(a==d):
money=1000+a*100
money1.append(money)
elif(b==c):
money=1000+b*100
money1.append(money)
elif(b==d):
money=1000+b*100
money1.append(money)
elif(c==d):
money=1000+c*100
money1.append(money)
else:
money=max(dice)*100
money1.append(money)
print(max(money1))
4651
#include<cstdio>
int main(){
int a, b, c, d, sum=0;
for(int i=1; i<=3; i++){
scanf("%d %d %d %d", &a, &b, &c, &d);
sum = a+b+c+d;
switch(sum){
case 1:
printf("C\n");
break;
case 2:
printf("B\n");
break;
case 3:
printf("A\n");
break;
case 4:
printf("E\n");
break;
default:
printf("D\n");
break;
}
}
}