V0,V1,V2,V3,N = map(int,input().split()) V = [V0,V1,V2,V3] cnt = 0 A = set() A.add((V0,0,0,0)) B = [V0,0,0,0] while cnt