#include using namespace std; using ll = long long; ll lcm(ll n, ll m){ return n*m/gcd(n, m); } int main(){ ll n; cin >> n; ll a, b, c; cin >> a >> b >> c; ll ab = lcm(a, b); ll bc = lcm(b, c); ll ca = lcm(c, a); ll abc = lcm(a, lcm(b,c)); ll ans = n/a+n/b+n/c-(n/ab+n/bc+n/ca)+n/abc; cout << ans << endl; return 0; }