#include using namespace std; using ll = long long; int main(){ ll n, a, b, c, ab, bc, ca, abc, A, B, C, AB, BC, CA, ABC; cin >> n >> a >> b >> c; ab = a * b / __gcd(a, b); bc = b * c / __gcd(b, c); ca = c * a / __gcd(c, a); abc = ab * c / __gcd(ab, c); A = n / a, B = n / b, C = n / c, AB = n / ab, BC = n / bc, CA = n / ca, ABC = n / abc; cout << A + B + C - AB - BC - CA + ABC << '\n'; }