n=int(input()) a,b,c=map(int,input().split()) s=tuple(map(str,input().split())) t=[len(i) for i in s] def f(m): check=[-1]*n tmp=0 R=-1 for L in range(n): while tmp