#include using namespace std; long long gcd(long long x,long long y){ if((x == 0) || (y == 0)) return 0; while(x != y){ if(x > y) x -= y; else y -= x; } return x; } long long lcm(long long x,long long y){ if((x == 0) || (y == 0)) return 0; return (x * y / gcd(x,y)); } int main(){ int a,b,c,n; cin >> n >> a >> b >> c; if(a == 1 && b == 1 && c == 1){ cout << n << endl; return 0; } cout << n / a + n / b + n / c - (n / lcm(a,b) + n / lcm(b,c) + n / lcm(a,c)) + n / lcm(a,lcm(b,c)) << endl; }