https://www.acmicpc.net/problem/1145
arr=list(map(int,input().split())) t=0; num=0; while 1: num+=1 for i in range(5): if num>=arr[i] and num%arr[i]==0: t+=1 if t>2: break t=0 print(num)