// // main.cpp // ProCon // // Created by hashimotoryoma on 2017/08/20. // Copyright © 2017年 hashimotoryoma. All rights reserved. // #include #include #include using namespace std; typedef long long ll; ll N; ll a,b,c; ll ans; ll gcd(ll x,ll y){ return y==0? x:gcd(y,x%y); } ll lcm(ll x,ll y){ return x*y/gcd(x,y); } int main() { // insert code here... return 0; ////// // input from txt /* std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); std::ofstream out("output.txt"); std::cout.rdbuf(out.rdbuf()); /////// */ cin >> N; cin >> a >> b >> c; ll ablcm = lcm(a,b); ans = N/a+N/b+N/c-N/ablcm-N/lcm(b,c)-N/lcm(c,a)+N/lcm(ablcm,c); cout << ans << endl; return 0; }