#include "bits/stdc++.h" using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 1000000007; //最大公約数 ll gcd(int m,int n){ if((m==0)||(n==0))return 0; while(m!=n){ if(m>n)m=m-n; else n=n-m; } return m; } //最小公倍数 ll lcm( int m, int n ) { if ( ( 0 == m ) || ( 0 == n ) ) return 0; return ((m / gcd(m, n)) * n); } int main() { ll n; int a,b,c; cin>>n; cin>>a>>b>>c; int ta,tb,tc; ll tab,tbc,tca,tabc; ta=n/a; tb=n/b; tc=n/c; tab=n/lcm(a,b); tbc=n/lcm(b,c); tca=n/lcm(c,a); tabc=n/lcm(lcm(a,b),c); print(ta+tb+tc-tab-tbc-tca+tabc); }