#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a%b); } // override function template of std::gcd long long gcd(int a, int b) { return gcd((long long)a, (long long)b); } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } // override function template of std::lcm long long lcm(int a, int b) { return lcm((long long)a, (long long)b); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n; int a, b, c; cin >> n >> a >> b >> c; long long ret = n/a + n/b + n/c; ret -= n/lcm(a,b) + n/lcm(b,c) + n/lcm(c,a); ret += n/lcm(lcm(a,b), c); cout << ret << endl; return 0; }