#include using namespace std; int gcd(int a, int b) { if (a == b) return a; if (a > b) { return gcd(a - b, b); } else { return gcd(a, b - a); } } int lcm(int a, int b) { return (a * b) / gcd(a, b); } 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; }