#include #include #include #include using namespace std; typedef long long int ll; ll gcd(ll m, ll n) { if ((0 == m) || (0 == n)) return 0; while (m != n) { if (m > n) m = m - n; else n = n - m; } return m; } ll lcm(ll m, ll n) { if ((0 == m) || (0 == n)) return 0; return ((m / gcd(m, n)) * n); } int main() { ll n, a, b, c; cin >> n; cin >> a >> b >> c; ll ans; ans = n / a + n / b + n / c; ans = ans - n / lcm(a,b) - n / lcm(b,c) - n / lcm(a,c); ans += n / lcm(a,lcm(b,c)); cout << ans << endl; return 0; }