#include using namespace std; using ll = long long; int main(){ ll n, ans = 0; vector a(3); cin >> n >> a[0] >> a[1] >> a[2]; for(int i = 1; i < 8; i++){ ll v = 1; for(int j = 0; j < 3; j++)if(i >> j & 1)v = lcm(v, a[j]); ans += (__builtin_popcount(i) & 1 ? 1: -1) * (n / v); } cout << ans << '\n'; }