#include using namespace std; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(i,a,b) for (int i = (a); i < (b); i++) #define RFOR(i,a,b) for (int i = (b)-1; i >= (a); i--) #define REP(i,n) for (int i = 0; i < (n); i++) #define RREP(i,n) for (int i = (n)-1; i >= 0; i--) #define ALL(x) (x).begin(), (x).end() #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define MP(x,y) make_pair((x), (y)) #define MIN(a,b) (a > b ? b : a) #define MAX(a,b) (a > b ? a : b) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MOD 1000000007 typedef long long ll; template inline void amin(T &x, U y) { if(y < x) x = y; } template inline void amax(T &x, U y) { if(x < y) x = y; } // ------------------------------------- long lcm(long n, long m) { return (n * m) / __gcd(n, m); } long N, a, b, c; int main() { cin >> N >> a >> b >> c; long na = N / a; long nb = N / b; long nc = N / c; long ab = lcm(a, b); long bc = lcm(b, c); long ca = lcm(c, a); long nab = N / ab; long nbc = N / bc; long nca = N / ca; long abc = lcm(a, lcm(b, c)); long nabc = N / abc; cout << na + nb + nc - nab - nbc - nca + nabc << endl; return 0; }