#include using namespace std; int main() { int n, a, b, c; cin >> n >> a >> b >> c; int 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; }