#include #include using namespace std; using lint=int64_t; template T gcd(T a,T b) { if(a==0 || b==0)return 0; T r; while(1) { r=a%b; if(r==0)break; a=b; b=r; } return b; } template T lcm(T a,T b) { if(a==0 || b==0)return 0; return a*(b/gcd(a,b)); } int main() { lint N; lint a,b,c; cin >> N; cin >> a >> b >> c; cout << N/a+N/b+N/c-N/lcm(a,b)-N/lcm(b,c)-N/lcm(c,a)+N/lcm(a,lcm(b,c)) << endl; return 0; }