#include using namespace std; #define ll long long ll gcd(ll a, ll b) { if (b > a) return gcd(b, a); if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { ll g = gcd(a, b); return (a / g) * b; } int main() { ll n; cin >> n; ll a, b, c; cin >> a >> b >> c; ll res = 0; res += n / a; res += n / b; res += n / c; res -= n / lcm(a, b); res -= n / lcm(b, c); res -= n / lcm(c, a); res += n / lcm(a, lcm(b, c)); cout << res << endl; return 0; }