var
a,b:array [1..100] of integer;
c:array [1..10] of integer;
z,x,l,v:string;
ch,ch1:char;
s,n,i:integer;
begin
assign(input,'scholar.in');
reset(input);
assign(output,'scholar.out');
rewrite(output);
read(n);
readln(z,x,l,v);
for i:=1 to n do
begin
readln(a[i]);
readln(b[i]);
readln(ch,ch1);
readln(c[i]);
end;
if (a[i]>80) and (c[i]>0) then s:=s+8000;
if (a[i]>85) and (b[i]>80) then s:=s+4000;
if a[i]>90 then s:=s+2000;
if (a[i]>85) and (ch='y') then s:=s+1000;
if (b[i]>80) and (ch1='y') then s:=s+850;
write(s);
close(input);
close(output);
end.