#include using namespace std; int gcd(int a,int b){ if(b==0){ return a; } return gcd(b,a%b); } int lcm(int a,int 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; }