#include #include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { ll n, a, b, c, ab, bc, ca, abc; cin >> n >> a >> b >> c; ab = n/(a*b/gcd(a, b)); bc = n/(b*c/gcd(b, c)); ca = n/(c*a/gcd(c, a)); abc = n/(a*b/gcd(a, b)*c/gcd(a*b/gcd(a, b), c)); cout << n/a + n/b + n/c - ab - bc - ca + abc << endl; }