#include int main() { long N; int a,b,c; int tmp; int num = 0; std::cin >> N; std::cin >> a >> b >> c; if(a < b) { tmp = a; a = b; b = tmp; } int aa = a; int bb = b; int r = aa % bb; while(r != 0) { aa = bb; bb = r; r = aa % bb; } r = (a*b)/bb; num=(N / a) + ((N / b) - (N / b / a)) + ((N / c) - (N / a / c) - (N / b / c) + (N / r / c)); std::cout << num << std::endl; return 0; }