import sys input = sys.stdin.readline import time time0=time.time() N,K=map(int,input().split()) T=list(map(int,input().split())) U=list(map(int,input().split())) def location(b,t): u=t%(4*b) if u<=b: return u u-=b if u<=b<=3*b: return b-u u-=2*b return -b+u def score_t(A): sc=0 for i in range(N): for j in range(i+1,N): sc+=abs(A[i]-A[j])/(B[i]+B[j]) return round(20000000*sc/50/49) def score_u(A): MAX=0 for i in range(N): for j in range(i+1,N): MAX=max(MAX,A[i]-A[j]) return 10000000/((MAX/20+1)**(1/2)) from random import randint maxscore=0 LA=[] while time.time()-time0<1.9: B=[randint(1,3) for i in range(N)] B.sort() sct=0 scu=0 for t in T: A=[location(B[i],t) for i in range(N)] sct+=score_t(A) for u in U: A=[location(B[i],t) for i in range(N)] scu+=score_u(A) if maxscore