#include using namespace std; #define int long long signed main(){ int N; cin >> N; int A, B, C; cin >> A >> B >> C; int ans = N / A + N / B + N / C; ans -= N / ( A * B / __gcd( A, B ) ); ans -= N / ( B * C / __gcd( B, C ) ); ans -= N / ( A * C / __gcd( A, C ) ); ans += N / ( A * B * C / __gcd( A, __gcd( B, C ) ) ); cout << ans << endl; return 0; }