#include using namespace std; typedef long long ll; int gcd(int a,int b){ if(b==0){ return a; } return gcd(b,a%b); } ll lcm(ll a,ll b){ return a*b/gcd(a,b); } int main(){ int n,a,b,c;cin >> n >> a >> b >> c; cout << n/a+n/b+n/c-n/lcm(a,b)-n/lcm(b,c)-n/lcm(c,a)+n/lcm(lcm(a,b),c) << endl; }