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