#include using namespace std; long lcm(long a, long b) { return (a * b) / __gcd(a, b); } int main() { long n, a, b, c; cin >> n >> a >> b >> c; long ans = n / a + n / b + n / c - n / lcm(a, b) - n / lcm(b, c) - n / lcm(c, a) + n / lcm(lcm(a, b), c); cout << ans << endl; return 0; }