#include #include #include #include using namespace std; using ll = long long int; ll gcd(ll num1, ll num2) { if(num2 == 0) return num1; if(num1 < num2) return gcd(num2, num1); return gcd(num2, num1 % num2); } ll lcm(ll num1, ll num2) { return ((num1 / gcd(num1, num2) * num2)); } int main() { ll N, a, b, c, cnt = 0; cin >> N >> a >> b >> c; ll ua = N / a; ll ub = N / b; ll uc = N / c; ll uab = N / lcm(a, b); ll uac = N / lcm(a, c); ll ubc = N / lcm(b, c); ll uabc = N / lcm(a, lcm(b, c)); printf("%lld\n", ua + ub + uc - uab - uac - ubc + uabc); return 0; }