////////////////////////////////////////////////////////////////////////////
//2353944 2010-11-19 22:35:25 Accepted 2397 C 40 164 VRS
//2397 田忌赛马 贪心
//1 田忌的最快与齐王最快比,田忌快则PK掉,田忌慢则用田忌最慢的PK齐王最快;
//2 快马相等的话,用田忌的最慢与齐王最慢比,田忌快则PK掉,田忌慢则PK齐王最快;
//3 最快与最慢都相等,则用田忌最慢PK掉齐王最快;
// 注意如果田忌最慢与王最快相等,那么剩下的就不用算了,都相等
#include<stdio.h>
#include<stdlib.h>
int cmp(const void* x,const void*y)
{
int *a=(int*)x;
int *b=(int*)y;
return *b-*a;
}
int main()
{
int tianHorse[1005];
int kingHorse[1005];
int n,i,count;
int tianHead,tianTail;
int kingHead,kingTail;
while(scanf("%d",&n) && n!=0)
{
for(i=0;i<n;i++)
scanf("%d",& tianHorse[i]);
for(i=0;i<n;i++)
scanf("%d",& kingHorse[i]);
qsort(tianHorse,n,sizeof(tianHorse[0]),cmp);
qsort(kingHorse,n,sizeof(kingHorse[0]),cmp);
count=0;
tianHead=kingHead=0;
tianTail=kingTail=n-1;
while(tianHead<=tianTail)
{
if(tianHorse[tianHead]>kingHorse[kingHead])
{
count++;
tianHead++;
kingHead++;
}
else if(tianHorse[tianHead]<kingHorse[kingHead])
{
count--;
tianTail--;
kingHead++;
}
else
{
if(tianHorse[tianTail]>kingHorse[kingTail])
{
count++;
tianTail--;
kingTail--;
}
else
{
if(tianHorse[tianTail]==kingHorse[kingHead])
break;
count--;
tianTail--;
kingHead++;
}
}
}
printf("%d\n",count*200);
}
return 0;
}