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