#include using namespace std; 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; }