#include using namespace std; #define rep(i, n) for (llong i = 0; i < (llong)(n); i++) #define llong long long llong gcd(llong a, llong b) { if(a % b == 0) return b; return gcd(b, a % b); } llong lcm(llong a, llong b) { return a * b / gcd(max(a, b), min(a, b)); } int main() { llong n, a, b, c; cin >> n; cin >> a >> b >> c; llong result = 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 << result << "\n"; }