#include using namespace std; using i64 = long long; #define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++) i64 N; i64 a,b,c; i64 gcd(i64 x,i64 y){ if(y == 0){ return x; } return gcd(y , x % y); } i64 lcm(i64 x,i64 y){ return x / gcd(x,y) * y; } int main(){ cin >> N >> a >> b >> c; i64 ans = N / a + N / b + N / c - (N / lcm(a,b)) - (N / lcm(a,c)) - (N / lcm(b , c)) + (N / lcm(lcm(a,b),c)); cout << ans << endl; }