#include using namespace std; #define int long long #define pb push_back #define sz(v) (int)(v.size()) #define all(v) (v.begin(),v.end()) #define uniq(v) (v).erase(unique(all(v)),(v).end()) #define mem1(a) memset(a,-1,sizeof(a)) #define mem0(a) memset(a,0,sizeof(a)) constexpr int pct(int x) { return __builtin_popcount(x); } constexpr int bits(int x) { return 31 - __builtin_clz(x); } const long long INF=1e18; const int32_t M=1e9+7; const int32_t MM=998244353; const long double pi = 3.14159265358979323846; template struct is_iterable : false_type {}; template struct is_iterable())),decltype(end(declval()))>> : true_type {}; template typename enable_if::value&&!is_same::value,ostream&>::type operator<<(ostream &cout, T const &v); template typename enable_if::value&&!is_same::value,ostream&>::type operator<<(ostream &cout, T const &v) { cout << "["; for (auto it = v.begin(); it != v.end();) { cout << *it; if (++it != v.end()) cout << ", "; } return cout << "]"; } template ostream& operator<<(ostream &cout, pair const &p) { return cout << "(" << p.first << ", " << p.second << ")"; } template istream& operator>>(istream& cin, pair &p) { cin >> p.first; return cin >> p.second; } long long lcm(int a, int b) { return (a / __gcd(a, b)) * b; } signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n,a,b,c; cin >> n >> a >> b >> c; int _a = n/a; int _b = n/b; int _c = n/c; int _ac = n/(lcm(a,c)); int _ab = n/(lcm(a,b)); int _bc = n/(lcm(b,c)); int _abc = n/(lcm(lcm(a,b),c)); // cout << _a << " " << _b << " " << _c << " " << _ab << " " << _bc << " " << _ac << " " << _abc; cout << _a + _b + _c - _ab -_ac - _bc + _abc << "\n"; return 0; }