N = raw_input() a,b,c = map(int,raw_input().split()) cnt = 0 for i in range(1,N): if i%a == 0 or i%b == 0 or i%c == 0: cnt = cnt + 1 print cnt