#include #include typedef long long ll; ll gcd(ll a, ll b) { while (a%b!=0 && b%a!=0) { if (a>b) a%=b; else b%=a; } return std::min(a, b); } inline ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } int main(void) { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(8); ll n, a, b, c; std::cin >> n >> a >> b >> c; ll ans = 0; ans += n/a + n/b + n/c; ans -= n/lcm(a, b) + n/lcm(b, c) + n/lcm(c, a); ans += n/lcm(a, lcm(b, c)); std::cout << ans << std::endl; return 0; }