#include using namespace std; #define int long long #define __gcd gcd int gcd( int a, int b ){ return 1; } 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; }