4
1 10 7 4
15 3 8 7
250

# -*- coding: utf-8 -*-
"""
Created on Fri Jul  3 22:39:10 2015

@author: ishank011
"""

def ans(a, b):
    if(len(a)==1):
        if a[0]>b[0]:
            return 100
        elif a[0]==b[0]:
            return 50
        else:
            return 0
    
    z=0
    for i in range(len(a)):
        x, y = a[:], b[:]
        del x[0]
        del y[i]
        if a[0]>b[i]:
            k=ans(x, y)+100
        elif a[0]==b[i]:
            k=ans(x, y)+50
        else:
            k=ans(x, y)
        if k>z:
            z=k
    return z
        
    

n=int(raw_input())
a = list(map(int, raw_input().split()))
b = list(map(int, raw_input().split()))
print(ans(a, b))