#include using namespace std; #define vi vector #define vs vector #define int long long int #define pii pair #define pb push_back #define f(i,a,b) for(int i=a;i>a[yon];} #define imx INT_MAX #define imn INT_MIN #define sortD(a) sort(a.end(),a.begin()); #define sortA(a) sort(all(a)); void solve(){ int n; cin >> n; int a, b, c; cin >> a >>b >> c; int ans = n/a + n/b + n/c; int lcmab = (a*b)/__gcd(a,b); int lcmac = (a*c)/__gcd(a,c); int lcmbc = (c*b)/__gcd(c,b); ans -= n/(lcmab); ans -= n/(lcmac); ans -= n/(lcmbc); int lcm = (c*lcmab)/__gcd(c,lcmab); cout<< ans + n/lcm ; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t=1; //cin>>t; while(t--){ solve(); } }