#include #include #include #include #include #include #include using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b, a % b); } int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, a, b, c; cin >> N >> a >> b >> c; ll ans = 0; ans += N / a + N / b + N / c; ans -= N / (a * b / gcd(a, b)) + N / (b * c / gcd(b, c)) + N / (c * a / gcd(c, a)); ll d = a * b / gcd(a, b); ans += N / (c * d / gcd(c, d)); cout << ans << endl; }