#include #include #include #define INF INT_MAX #define LINF LONG_LONG_MAX #define int long long #define all(a) a.begin(), a.end() #define f first #define s second #define vi vector #define vvi vector> #define vvvi vector>> #define vii vector> #define seed chrono::high_resolution_clock::now().time_since_epoch().count() #define file_read(filepath) freopen(filepath, "r", stdin); #define file_write(filepath) freopen(filepath, "w", stdout); #define fastio \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define MOD 1000000007 using namespace std; using pii = pair; using namespace __gnu_pbds; template using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; template ostream &operator<<(ostream &os, const pair &p) { return os << '(' << p.first << ", " << p.second << ')'; } template void print(vector &array, int size = numeric_limits::max()) { for (int i = 0; i < min(size, array.size()); i++) { cout << array[i] << " "; } cout << "\n"; } template void print(T X) { cout << X << "\n"; } template void print(T X, Ts... Y) { cout << X << " "; print(Y...); } void solve() { int n; cin >> n; int a, b, c; cin >> a >> b >> c; int a1 = n / a; int a2 = n / b; int a3 = n / c; int a4 = n / lcm(a, b); int a5 = n / lcm(a, c); int a6 = n / lcm(b, c); int a7 = n / lcm(a, lcm(b, c)); int answer = a1 + a2 + a3 - a4 - a5 - a6 + a7; print(answer); } signed main() { fastio; int t = 1; // cin >> t; while (t--) { solve(); } return 0; }