#include #include #include #include #include #include #include #include #include #include // #include #include #define int long long #define inf 1000000007 #define pa pair #define ll long long #define pal pair #define ppa pair #define ppap pair #define ssa pair #define mp make_pair #define pb push_back #define EPS (1e-12) #define equals(a,b) (fabs((a)-(b)) using namespace std; class pas{ public: int x,y; pas(int x=0,int y=0):x(x),y(y) {} pas operator + (pas p) {return pas(x+p.x,y+p.y);} pas operator - (pas p) {return pas(x-p.x,y-p.y);} pas operator * (int a) {return pas(x*a,y*a);} pas operator / (int a) {return pas(x/a,y/a);} // double absv() {return sqrt(norm());} int norm() {return x*x+y*y;} bool operator < (const pas &p) const{ return x != p.x ? x struct Segment{ Point p1,p2; }; struct star{ Segment se[5]; }; double dot(Vector a,Vector b){ return a.x*b.x+a.y*b.y; } double cross(Vector a,Vector b){ return a.x*b.y-a.y*b.x; } bool parareru(Point a,Point b,Point c,Point d){ // if(abs(cross(a-b,d-c)) circle_intersection(Point c1,double r1,Point c2,double r2){ double d=(c1-c2).absv(); double h=(r1*r1-r2*r2+d*d)/2.0/d; double l=sqrt(r1*r1-h*h); // cout< z=mp(asi+sui*l,asi-sui*l); if(z.first.x>z.second.x) swap(z.first,z.second); return z; } int gcd(int x,int y){ if(x (const pa2 &p) const{ return x != p.x ? x>p.x: y>p.y; } bool operator == (const pa2 &p) const{ return abs(x-p.x)==0 && abs(y-p.y)==0; } bool operator != (const pa2 &p) const{ return !(abs(x-p.x)==0 && abs(y-p.y)==0); } }; vector ve; int dp[1000001][3]={0}; signed main(){ int n,a,b,c; cin>>n>>a>>b>>c; int ans=0; ans+=n/a; ans+=n/b; ans+=n/c; ans-=n/lcm(a,b); ans-=n/lcm(b,c); ans-=n/lcm(a,c); ans+=n/lcm(lcm(a,b),c); cout<