#include "bits/stdc++.h" using namespace std; #define ll long long int #define rep(i,n) for( int i = 0; i < n; i++ ) #define rrep(i,n) for( int i = n; i >= 0; i-- ) #define REP(i,s,t) for( int i = s; i <= t; i++ ) #define RREP(i,s,t) for( int i = s; i >= t; i-- ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 #define int long long int gcd(int a, int b) { if (b > a) return gcd(b, a); else if (b == 0) return a; else return gcd(b, a % b); } int lcm(int a, int b) { return a * b / gcd(a, b); } signed main(void) { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; int a, b, c; cin >> a >> b >> c; int times_a = N / a; int times_b = N / b; int times_c = N / c; int times_a_b = N / lcm(a, b); int times_a_c = N / lcm(a, c); int times_b_c = N / lcm(b, c); int times_a_b_c = N / lcm(lcm(a, b), c); cout << times_a + times_b + times_c - times_a_b - times_a_c - times_b_c + times_a_b_c << endl; return 0; }