#include typedef long long ll; using namespace std; ll gcd(ll n, ll m){return m?gcd(m,n%m):n;} ll lcm(ll n, ll m){return n/gcd(n,m)*m;} int main(){ ll N,a,b,c; cin >> N >> a >> b >> c; cout << N/a+N/b+N/c-N/lcm(a,b)-N/lcm(b,c)-N/lcm(a,c)+N/lcm(lcm(a,b),c) << endl; }