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