#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;

int main()
{
	int a,b,c,d,sum;
	cin>>a>>b>>c>>d>>sum;
	set<int>v1;
	bool ch=0;
	if(a==1||b==1||c==1||d==1)
	{
		cout<<sum;

		return 0;

	}

	for (int i = 1; i < sum; i++)
	{
		if((a*i)<=sum)
			v1.insert(a*i);
		else
			break;

	}

	for (int i = 1; i < sum; i++)
	{
		if((b*i)<=sum)
			v1.insert(b*i);
		else
			break;
	}

	for (int i = 1; i < sum; i++)
	{
		if((c*i)<=sum)
			v1.insert(c*i);
		else
			break;
	}

	for (int i = 1; i < sum; i++)
	{
		if((d*i)<=sum)
			v1.insert(d*i);
		else
			break;
	}
	cout<<v1.size();

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	int a,b,c,d,n;
	cin>>a>>b>>c>>d>>n;
	int res=0;
	for(int i=1;i<=n;i++)
	{
	    if(i%a==0)res++;
	    else if(i%b==0)res++;
	    else if(i%c==0)res++;
	    else if(i%d==0)res++;
	}
	cout<<res;
	return 0;
}

// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <conio.h>
#include <iostream>
#include <cmath>

#define ll long long
using namespace std;

int main()
{
	ll int k, l, m, n, d,i,sh;
	sh = 0;
	cin >> k >> l >> m >> n >> d;
	for (i = 1; i <= d; i++)

	{
		if (i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0)
			sh++;
	}
	cout << sh;

    return 0;
}

#include<iostream>
using namespace std;
int main()
{
long long a,b,c,d,n,q[10000000],k=0;
cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>n;
for(int i=0;i<n;i++)
q[i]=0;
for(int i=a;i<=n;i+=a)
if(q[i]==0)
q[i]=1;
for(int i=b;i<=n;i+=b)
if(q[i]==0)
q[i]=1;
for(int i=c;i<=n;i+=c)
if(q[i]==0)
q[i]=1;
for(int i=d;i<=n;i+=d)
if(q[i]==0)
q[i]=1;
for(int i=1;i<=n;i++)
if(q[i]==1)
k++;
cout<<k;
return 0;
}

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include <map>
#include <ctype.h>
#include <iomanip>
#include<cmath>
using namespace std;

int main(){
	int n, sum = 0;
	vector <int> vec(4);
	cin >> vec[0] >> vec[1] >> vec[2] >> vec[3] >> n;

	vector <int> drgn;

	if (vec[0] == 1 || vec[1] == 1 || vec[2] == 1 || vec[3] == 1)cout << n;
	else{
		for (int i = 0; i < (vec.size() - 1); i++){
			for (int j = i + 1; j < vec.size(); j++){
				if (vec[i] == vec[j] || vec[i] % vec[j] == 0){ vec.erase(vec.begin() + i); j--; }
				else if (vec[j] % vec[i] == 0){ vec.erase(vec.begin() + j); j--; }
			}
		}

		sort(vec.begin(), vec.end());

		for (int i = vec[0]; i <= n; i += vec[0])drgn.push_back(i);
		bool test = 1;
		for (int k = 1; k < vec.size(); k++){
			for (int i = vec[k]; i <= n; i += vec[k]){
				test = 1;
				for (int j = 0; j < drgn.size(); j++){
					if (drgn[j] == i)test = 0;
				}
				if (test)drgn.push_back(i);
			}
		}

		cout << drgn.size();
	}

	return 0;
}

#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    int n,k,l,m,d,i,cot;
    cin>>k>>l>>m>>n>>d;
    cot=0;
    for(i=1;i<=d;i++)
    {
        if(i%k==0||i%l==0||i%m==0||i%n==0)
            cot++;
           // cout<<cot<<endl;
             }
    cout<<cot<<endl;
    return 0;
}

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main()
{
    int patelnia, ogon, pazur, mama;
    int smk;

    cin >> patelnia;// >> endl;
    cin >> ogon;
    cin >> pazur;
    cin >> mama;

    cin >> smk;

    int *smoki;
    smoki = new int[100001];

    //wszedzie 0 w smoki
    for(int j=1; j<=smk; j++)
    {
        smoki[j]=0;
    }

    int zmienne[4];

    zmienne[0]=patelnia;
    zmienne[1]=ogon;
    zmienne[2]=pazur;
    zmienne[3]=mama;

    for(int i=0; i<=3; i++)
    {
        if(zmienne[i]==1)
        {
            cout << smk;
            return 0;
        }
    }

    for(int i=0; i<=3; i++)
    {
        for(int j=1; j<=smk; j++)
        {
            if(j%zmienne[i]==0)
            {
                smoki[j]++;
            }
        }
    }

    int nie_zera =0;
    for(int j=1; j<=smk; j++)
    {

        if(smoki[j]!=0)
        {
            nie_zera++;
        }
    }
    cout << nie_zera;
    return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int k, l, m, n;
	long long d;
	cin >> k >> l >> m >> n;
	cin >> d;
	int suffering = 0;
	for (int i = 1; i <= d; i++)
	{
		if (i % k == 0)
		{
			suffering++;
		}
		else
		{
			if (i % l == 0)
			{
				suffering++;
			}
			else
			{
				if (i % m == 0)
				{
					suffering++;
				}
				else
				{
					if (i % n == 0)
					{
						suffering++;
					}
				}
			}
		}
	}
	cout << suffering << endl;

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,l,m,n,d,sum=0;
	cin>>k>>l>>m>>n>>d;
	for(int i=1;i<=d;i++)
	{
		if(i%k==0||i%l==0||i%m==0||i%n==0)
		{
			sum++;
		}
	}
	cout<<sum;
}

#include <stdio.h>

const int N = 100005;

bool drag[N];

int main()
{
	int k, l, m, n, d;

	scanf("%d %d %d %d %d", &k, &l, &m, &n, &d);

	for(int i = 1; i <= d; i++){
		drag[i] = false;
	}
	for(int i = k; i <= d; i += k){
		drag[i] = true;
	}
	for(int i = l; i <= d; i += l){
		drag[i] = true;
	}
	for(int i = m; i <= d; i += m){
		drag[i] = true;
	}
	for(int i = n; i <= d; i += n){
		drag[i] = true;
	}
	int ans = 0;
	for(int i = 1; i <= d; i++){
		if(!drag[i]){
			ans++;
		}
	}
	printf("%d\n", d - ans);

	return 0;
}
// 1483723849231

#include<stdio.h>
int main()
{
	unsigned int k,l,m,n,d;
	unsigned int i;
	unsigned int count=0;
	scanf("%d",&k);
	scanf("%d",&l);
	scanf("%d",&m);
	scanf("%d",&n);
	scanf("%d",&d);
	for(i=1;i<=d;i++)
	{
		if(i%k==0)
		{
			count++;
			continue;
		}
		if(i%l==0)
		{
			count++;
			continue;
		}
		if(i%m==0)
		{
			count++;
			continue;
		}
		if(i%n==0)
		{
			count++;
			continue;
		}
	}
	printf("%d",count);
	return 0;
}

#include <iostream>
using namespace std;
int main()
{
	int n, k , l ,m , d;
	int counter=0;
	cin >> n >> k >> l >> m >> d;
	for (int i=1 ; i<=d ; i++)
	{
	if (i%n ==0 || i%k ==0 || i%l ==0 ||i%m ==0 )
	{
	counter++;
	}
	}
	cout << counter;
//system ("pause");
return 0;
}

#include <iostream>
//#include <math.h>
//#include <vector>

using namespace std;
int main() {
  int k,l,m,n,d;
  int sum = 0;
  cin>>k>>l>>m>>n>>d;
  for(int i = 1;i<=d;i++){
      if(i%k==0||i%l==0||i%m==0||i%n==0){
          sum++;
      }
  }
  cout<<sum;
   return 0;
}

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int k,l,m,n,d;
	cin>>k>>l>>m>>n>>d;
	int x=0;
	for(int i=1;i<=d;i++)
	{
		if(i%k==0||i%l==0||i%m==0||i%n==0)
			x++;
	}
	cout<<x<<endl;
}

#include<bits/stdc++.h>

using namespace std;

int main() {

	int k,l,m,d,n,countk=-1;
	int countl=-1,countm=-1,countn=-1;

	cin>>k;
	cin>>l;
	cin>>m;
	cin>>n;
	cin>>d;

	if(k==1||l==1||m==1||n==1) {
		cout<<d;
	}
	else {
	vector<int> v(d,0);

	while(countk<=(d-1)) {
		countk=countk+k;
		if(countk<=(d-1))
			v[countk]=1;
	}
	while(countl<=(d-1)) {
		countl = countl+l;
		if(countl<=(d-1))
			v[countl]=1;
	}

	while(countm<=(d-1)) {
		countm=countm+m ;
		if(countm<=(d-1))
			v[countm]=1;
	}

	while(countn<=(d-1)) {
		countn=countn+n;
		if(countn<=(d-1))
			v[countn]=1;
	}
	int countf=0;
	for(int i=0;i<d;i++) {
		//cout<<v[i]<<" ";
		if(v[i]==0) {
			countf++;
		}
	}

	cout<<(d)-countf;
	}

	return 0;
}

#include <iostream>
int main()
{int k,l,m,n,d;std::cin>>k>>l>>m>>n>>d;int res=d;for(int i=1;i<=d;i++)if(i%k!=0&&i%l!=0&&i%m!=0 &&i%n!=0)res--;std::cout<<res;}

#include<iostream>
using namespace std;
int main()
{
	int k, l,m,n,d;

		cin >> k >> l >> m >> n >> d;

		int count = 0;

		for (int i = 1; i <= d; i++)
		{
			if ((i%k == 0 )|| (i%l == 0 ) || (i%m == 0 )|| (i%n == 0))
				count++;
		}

		cout << count << endl;

		return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int main(){
	int k, l, m, n, d;
	int sum = 0;
	cin >> k >> l >> m >> n >> d;

	for(int i = 1; i <= d; i++)
		sum += !(i % k && i % l && i % m && i % n);

	cout << sum;
}

#include<bits/stdc++.h>

using namespace std;

int main(){
    int k, l, m, n, d;

    cin >> k >> l >> m >> n >> d;
    vector<int> v(d+2);

    for(int i = 1; i*k <= d; i++)
        v[i*k] = 1;

    for(int i = 1; i*l <= d; i++)
        v[i*l] = 1;

    for(int i = 1; i*m <= d; i++)
        v[i*m] = 1;

    for(int i = 1; i*n <= d; i++)
        v[i*n] = 1;

    int c = 0;
    for(int i = 1; i <= d; i++)
        if(v[i] != 0)
            c++;
    cout << c << '\n';

    return 0;
}
// 1483727892970

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void main()
{
	int k, l, m, n, d;
	cin >> k;
	cin >> l;
	cin >> m;
	cin >> n;
	cin >> d;
	vector <int> a(d);
	for (int i = 0; i < d; i++) a[i] = 0;
	for (int i = k; i <= d; i = i + k) a[i-1] = 1;
	for (int i = l; i <= d; i = i + l) a[i-1] = 1;
	for (int i = m; i <= d; i = i + m) a[i-1] = 1;
	for (int i = n; i <= d; i = i + n) a[i-1] = 1;
	int c = 0;
	for (int i = 0; i < d; i++)
		if (a[i] == 1)
			c++;
	cout << c;

}

#include<stdio.h>
#include<string.h>
int main(void)
{
	int k,l,m,n,d,i,sum=0;
	scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
	for(i=1;i<=d;++i)
	{
		if(i%k==0||i%l==0||i%m==0||i%n==0)
			sum++;
	}
	printf("%d\n",sum);
	return 0;
}

#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
int k,l,m,n,d,count=0;
	cin>>k>>l>>m>>n>>d;
	int a[100001]={0};
	for(int i=1;i<=d;++i)
		if(i%k==0 ||i%l==0 ||i%m==0|| i%n==0)++count;
	cout<<count<<endl;
}

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
const int size = 1000000;
bool a[size];
int main(){
	int k, l, m, n, d; cin >> k >> l >> m >> n >>d;
	for (int i = 0; i < size; i+= k){
		a[i] = true;
	}
	for (int i = 0; i < size; i+= l){
		a[i] = true;
	}
	for (int i = 0; i < size; i+= m){
		a[i] = true;
	}
	for (int i = 0; i < size; i+= n){
		a[i] = true;
	}
	int temp = 0;
	for (int i = 1; i <= d; i++){
		if (a[i]) temp++;
	}
	cout << temp;
	return 0;
}

#include<stdio.h>
int main(void)
{
    int k,l,m,n,d;
    scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
    int count=0;
    for(int i=1;i<=d;i++)
    {
        if(i%k==0||i%l==0||i%m==0||i%n==0)
        count++;
    }
    printf("%d",count);
}

#include <iostream>
using namespace std;
int pain[4], dragons, output;
int main() {
	for(int i=0; i<4; i++){
		cin>>pain[i];
	}
	cin>>dragons;
	for(int i=1;i<=dragons; i++){
		if((i%pain[0]==0)||(i%pain[1]==0)||(i%pain[2]==0)||(i%pain[3]==0)){
			output++;
		}
	}
	cout<<output;
}

#include <iostream>
using namespace std;
void func(int mas[],int d,int x,int &kol)
{
	for (int i=0; i<=d; i=i+x)
	{if (mas[i]==0)
	kol++;
	mas[i]=i;
	}
	return;
}
int main()
{int k,l,m,n,d1;
int kol=0,kol1=0;
int const d=100001;
cin>>k;
cin>>l;
cin>>m;
cin>>n;
cin>>d1;
int a[d];
for (int i=0; i<=d1; i++)
a[i]=0;
if (k==1||l==1||m==1||n==1)
kol=d1;
	else
	{
		if (k==l==m==n)
	func(a,d1,k,kol);
		else
		{
	func(a,d1,k,kol);
	func(a,d1,l,kol);
	func(a,d1,m,kol);
	func(a,d1,n,kol);
	kol-=4;
		}
	}

cout<<kol;
return 0;
}

// tags:   constructive algorithms     implementation     math
//complexity : O(log(k*l*m*n))
//using LCM and inclusion exclusion principle

#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
ll gcdEuclideanAlgorithmMod_Ologminab(ll a, ll b){
    //O(log(min(a,b)))
    while(b!=0){
        a%=b;
        swap(a,b);
    }
    return a;
}
///least common multiple lcm
ll lcm_Ologminab(ll a, ll b){
    /*
     2 known mathematical definitions:
     The first definition is min value l ,such that l%a=0 and l%b=0.
     For this definition lcm(a,0) is undefined.To use this definition, use the function as is.
     This definition is the most commonly used in competitive programming
     the second definition is min value l, such that a|l and b|l
     For this definition lcm(a,0) is 0. To use this definition, add the following line:
     if(a==0||b==0) return 0
     */
    return a/gcdEuclideanAlgorithmMod_Ologminab(a, b)* b;
}

ll lcm( vector<ll> v){
    ll ans=1;
    for(ll& a:v){
        ans=lcm_Ologminab(ans,a);
    }
    return ans;
}

int main(){
  ll k,l,m,n,d;
 	cin>>k>>l>>m>>n>>d;
 	ll lcmklmn=lcm({k,l,m,n});
 	ll ans=-1;

 	for(ll i=0;i<lcmklmn;i++){
 		if(i%k==0 || i%l==0 || i%m==0 || i%n==0){
 			ans+=d/lcmklmn;
 			if(i<=d%lcmklmn)
 				ans++;
 		}
 	}

 	cout<<ans;
}

#include <iostream>
using namespace std;

int main()
{
    int k, l, m, n, d, count=0;
    int dragon[100001] = {0};
    cin>>k>>l>>m>>n>>d;
    for(int i=k; i<=d; i+=k)
    {
        dragon[i]=1;
    }
    for(int i=l; i<=d; i+=l)
    {
        dragon[i]=1;
    }
    for(int i=m; i<=d; i+=m)
    {
        dragon[i]=1;
    }
    for(int i=n; i<=d; i+=n)
    {
        dragon[i]=1;
    }
    for(int i=0; i<=d; i++)
    {
        if(dragon[i]==1)
         count++;
    }
    cout<<count;
    return 0;
}

#include<iostream>
using namespace std;

main(){
  long k=0, l=0, m=0, n=0;
  long d = 0, count = 0;

  cin >> k >> l >> m >> n >> d;

  for(long i = 1; i < d+1; i++){
     if(i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)
       count++;
  }

  cout << count << endl;

}

#include<stdio.h>
int main()
{
    int i,k,l,m,n,d,c=0;
    scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);
    for(i=1;i<=d;i++)
    {
        if(i%k==0)
            c++;
        else if(i%l==0)
            c++;
        else if(i%m==0)
            c++;
        else if(i%n==0)
            c++;
    }
    printf("%d\n",c);
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
int x,y,z,k,m=0,l;

    cin>>x>>y>>k>>l>>z;
for (int i=1;i<=z;i++)
{
    if(i%x==0||i%k==0||i%y==0||i%l==0)
        m++;
}cout <<m<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int m[4];
    for (int i=0; i < 4; i++)
    {
        cin >> m[i];
    }

    int d;
    cin >> d;

    for (int i=0; i < 4; i++)
    {
        if (m[i] == 1)
        {
            cout << d;
            return 0;
        }
    }

    int count = 0;
    for (int i=1; i <= d; i++)
    {
        for (int j=0; j < 4; j++)
        {
            if (!(i % m[j]))
            {
                count += 1;
                break;
            }
        }
    }

    cout << count;
    return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int vis[2000000];
int main()
{
    int k,l,m,n,d;
    while(~scanf("%d",&k))
    {
        scanf("%d",&l);
        scanf("%d",&m);
        scanf("%d",&n);
        scanf("%d",&d);
        memset(vis,0,sizeof(vis));
        int i,ans=0;
        for(i=1;i<=d;i++)
        {
            if(i%k==0)
            {
                vis[i]=1;
            }
            if(i%l==0)
            {
                vis[i]=1;
            }
            if(i%m==0)
            {
                vis[i]=1;
            }
            if(i%n==0)
            {
                vis[i]=1;
            }
            if(vis[i]==1)
                ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

#include<iostream>

using namespace std;

int main(){
	int k,l,m,n,d,counter=0;
	cin>>k>>l>>m>>n>>d;
	for(int i=1 ; i<=d ; i++)
	{
		if(i%k==0 || i%l==0 || i%m==0 || i%n==0 )
		{
			counter++;
		}
	}
	cout<<counter<<endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define ll long long
#define PI 3.1415926535897932384626
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define br printf("\n")
#define fo(i, n) for(i=0;i<n;i++)
#define Fo(i, k, n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define deb(x) cout << #x << " = " << x << endl;
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define deba(i, a, n) fo(i, n){cout << a[i] << " ";}
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define trr(it, x) for(auto it = x.rbegin(); it != x.rend(); it+)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}

const int mod = 1'000'000'007;
const int N = 3e5;

vi v[N];
int a[N];

/* ========== YOUR CODE HERE ========= */

void solution() {
    int k,l,m,n,d,i;
    int res = 0;
		//cin>>k>>l>>m>>n>>d;
		si(k),si(l),si(m),si(n),si(d);
    for(i = 1; i <= d; i++){
				if((i % k==0)|| (i % l == 0 )|| (i % m == 0 )|| (i % n == 0)){
						res ++;
				}
		}
		pi(res);

}

/* ========== YOUR CODE HERE ========= */

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solution();

    return 0;
}

#include<iostream>
#include <deque>
#include<stack>
#include<queue>
#include<math.h>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<stdio.h>
#include<string.h>
typedef long long LL;
#define $ acos(-1)
using namespace std;
int main()
{
    for(;;)
    {
        int k,l,m,n,d,i,j,s=0,a[100000]={0};
        if(scanf("%d",&k)==EOF)
            break;
        scanf("%d%d%d%d",&l,&m,&n,&d);
        if((k==1)||(l==1)||(n==1)||(m==1))
        {
            printf("%d\n",d);
            continue;
        }
        for(i=1;i<=d;i++)
        {
            if(i%k==0)
                a[i]++;
            if(i%l==0)
                a[i]++;
            if(i%m==0)
                a[i]++;
            if(i%n==0)
                a[i]++;
        }
        for(i=0;i<=d;i++)
            if(a[i]!=0)
              s++;
        printf("%d\n",s);

    }
    return 0;
}

#include<bits/stdc++.h>
#define f(i,n) for(int i=1;i<=n;i++)
using namespace std;

int main(){
    int k,l,m,n,d,c=0;
    bool A[1000];
    cin>>k>>l>>m>>n>>d;
    f(i,d)
    {
        if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0)){
            A[i]=false;
            c++;
        }
    }
    cout<<c;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define vi vector<ll>
#define mod 1000000007
#define st(v) sort(v.begin(),v.end())
#define inv(i,n,v) for(ll i=0;i<n;i++)cin>>v[i]
#define fr(i,n) for(int i=0;i<n;i++)
#define pb(x) push_back(x)
#define nl cout<<endl
#define l(s) s.size()
void solve(){
    vi a(5);
    inv(i,5,a);
    int c=0;
    for(int i=1;i<=a[4];i++)
    {
        if(i%a[0] && i%a[1] && i%a[2] && i%a[3] )
        c++;
    }

    cout<<a[4]-c;
  return;
}

int main()
{
  fast;
  ll t=1;
  while(t--)
  {
    solve();
  }
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,l,m,n,d;
    cin>>k>>l>>m>>n>>d;
    int c=0;
    for(int i=1;i<=d;i++)
    {
        if(i%k!=0&&i%l!=0&&i%m!=0&&i%n!=0)
        {
            //cout<<i<<endl;
           c++;
        }

    }
    //cout<<c<<endl;
    int ans=d-c;
    cout<<ans<<endl;
    return 0;
}

 #include<bits/stdc++.h>
 using namespace std;
 int main()
 {
     int k,l,m,n,d,count=0;
     cin>>k>>l>>m>>n>>d;
     for(int i=1; i<=d; i++){
         if(i%k==0 || i%l==0 || i%m==0 || i%n==0)
            count++;
     }
     cout<<count<<endl;
 }

#include <bits/stdc++.h>
#include <iostream>
using namespace std;

int main()
{
  int k,l,m,n,d,x=0;
cin>>k>>l>>m>>n>>d;
for(int i=1;i<=d;i++){
    if(i%k==0||i%l==0||i%m==0||i%n==0)
        x++;
}
    cout<<x ;

}

#include<iostream>
using namespace std;
int k,l,m,n,d;
int main()
{
    cin>>k>>l>>m>>n>>d;
    int ans=0;
    for(int i=1;i<=d;i++)
    {
        if(i%k==0||i%l==0||i%m==0||i%n==0)//判断，如果满足条件就+1
        ans++;
    }
    cout<<ans;//愉快的输出，AC啦！锵锵！
    return 0;
}

#include <iostream>
using namespace std;

int main()
{
    int a[4],n,s=0;
    for(int i=0;i<4;i++)
        cin>>a[i];
    cin>>n;

    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<4;j++)
        {
            if(i%a[j]==0)
            {
                s++;
                break;
            }
        }
    }
    cout<<s<<endl;
    return 0;
}

#include <iostream>
using namespace std;

int main ()
{
    int k, l, m, n, d, counter;
    counter = 0;
    cin >> k >> l >> m >> n >> d;
    for (int i = 1; i <= d; i++)
    {
        if (i%k == 0 || i%l == 0 || i%m == 0 || i%n ==0)
        {
            counter++;
        }
    }
    cout << counter << endl;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int k,l,m,n,d;
	while(~scanf("%d%d%d%d%d",&k,&l,&m,&n,&d)){
		int i,N=0;
		for(i=1;i<d+1;i++)
			if(i%k&&i%l&&i%m&&i%n) N++;
		printf("%d\n",d-N);
	}
       return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main (){
	int k, l, m, n, d;
	cin >> k >> l >> m >> n >> d;
	int ans=0;
	for(int i=1; i<=d; i++){
		ans+=!(i%k && i%l && i%m && i%n);
	}
	cout << ans << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
	int k, l, m, n, d;
	cin >> k >> l >> m >> n >> d;
	int c = d;
	if(k == 1 || l == 1 || m == 1 || n == 1) cout << d<<endl;
	else {
		for(int i = 0; i <= d; i++)
		    if(i%k != 0 && i%l != 0  && i%m != 0 && i%n != 0)       c--;
		cout << c<<endl;
	}
	return 0;
}

#include <bits/stdc++.h>

const int MaxSize=1e5+5;
using namespace std;

int a,b,c,d;
bool Arr[MaxSize];

void PrimeFactorization()
{
    for(int i=1;i<MaxSize+1;i++)
    if(i==a or i==b or i==c or i==d)
        for(int j=2*i;j<MaxSize+1;j+=i)
            Arr[j]=1;
}

int main()
{

    int e;
    cin>>a>>b>>c>>d>>e;
    Arr[a]=Arr[b]=Arr[c]=Arr[d]=1;
    PrimeFactorization();

    int Ans=0;
    for(int i=1;i<=e;i++)
        Ans+=Arr[i];

    cout<<Ans;
}

#include <iostream>
using namespace std;
int x=0, k, l, m, n, d, i;
int main()
{
cin>>k>>l>>m>>n>>d;
for(int i(1); i<=d; i++)
    if(i%k==0||i%l==0||i%m==0||i%n==0)
    x++;
cout<<x;
return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int k,l,m,n,d,c=0;
    cin>>k>>l>>m>>n>>d;
    for(int i=1;i<=d;i++)
    {
        if(i%k==0||i%l==0||i%m==0||i%n==0)c++;
    }
   cout<<c;

    return 0;

}

#include<bits/stdc++.h>
using namespace std;

int main(){
long long int a,b,c,d,t,nf=0;

cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>t;

for(int i=1;i<=t;i++){

    if((i%a)==0 ||( i%b)==0 || (i%c)==0 || (i%d)==0 ){

    nf++;
    }

}

cout<<nf<<endl;
return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    int k=0, l=0, m=0 , n=0, total=0, dragones=0, count=0, aux=0; //variables
    int i=0; // contadores
    cin>>k>>l>>m>>n>>total;                  //dragones K
    dragones=total/k;
    //                                       dragones L
    count=total/l;
    aux=l;
    if(l%k!=0)
    {
        for ( i = 0; i < count; i++)
        {
            if (l%k!=0)
            {
                dragones++;
            }
            l+=aux;
        }

    }
    l=aux;
    //                                        dragones M
    count=total/m;
    aux=m;
    if(m%k!=0 && m%l!=0)
    {
        for ( i = 0; i < count; i++)
        {
            if (m%k!=0 && m%l!=0)
            {
                dragones++;
            }
            m+=aux;
        }

    }
    m=aux;
    //                                          dragones N
    count=total/n;
    aux=n;
    if(n%k!=0 && n%l !=0 && n%m !=0)
    {
        for ( i = 0; i < count; i++)
        {
            if (n%k!=0 && n%l !=0 && n%m !=0)
            {
                dragones++;
            }
            n+=aux;
        }

    }
    cout<<dragones<<endl;
    return 0;
}

#include <cstdio>

using namespace std;

int main(){
    int a,b,c,d;

    scanf("%d %d %d %d",&a,&b,&c,&d);

    int n,ans = 0;

    scanf("%d",&n);

    for(int i = 1;i <= n;++i)
        if(i % a == 0 || i % b == 0 || i % c == 0 || i % d == 0)
            ++ans;

    printf("%d\n",ans);

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
	int a,b,c,d,n;
	cin>>a>>b>>c>>d>>n;

	set<int> s;
	int i,j;

	for(i=a;i<=n;i=i+a)
	{
		if(s.find(i)==s.end())
		{
		    s.insert(i);
		}
	}

	for(i=b;i<=n;i=i+b)
	{
		if(s.find(i)==s.end())
		{
		    s.insert(i);
		}
	}

	for(i=c;i<=n;i=i+c)
	{
		if(s.find(i)==s.end())
		{
		    s.insert(i);
		}
	}

	for(i=d;i<=n;i=i+d)
	{
		if(s.find(i)==s.end())
		{
		    s.insert(i);
		}
	}

	cout<<s.size();
}

#include <iostream>
using namespace::std;

main()
{
	ios_base::sync_with_stdio(false);					// Fast I/O
	int k, l, m, n, d, count=0;
	cin >> k >> l >> m >> n >> d;

	for (int i=1; i<=d; i++)
	{
		if (!(i%k)||!(i%l)||!(i%m)||!(i%n))
			count++;
	}
	cout << count;
}

#include<iostream>
#include<iomanip>
#include<cmath>
#include<fstream>
#include<algorithm>
#include<string>
#include <sstream>
using namespace std;
int arr[10000000];
int main()
{
	int k,L,m,n , d,c=0;
       cin>>k>>L>>m>>n>>d;
	   for(int i=k;i<=d;i+=k)
	   {
	     arr[c++]=i;
	   }
	   for(int i=L;i<=d;i+=L)
	   {
	     arr[c++]=i;
	   }
	   for(int i=m;i<=d;i+=m)
	   {
	     arr[c++]=i;
	   }
	   for(int i=n;i<=d;i+=n)
	   {
	     arr[c++]=i;
	   }
	   int tp=c;
     sort(arr,arr+c);
	 for(int i=0 ;i<c-1;i++)
	 {
	    if(arr[i]==arr[i+1])tp--;

	 }
	 cout<<tp;

}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int k,l,m,n,d;
    vector <int> x;
    cin >>k>>l>>m>> n>>d;
    for(int i = 1; i<=d; i++){
        if(i%k == 0|| i%l == 0|| i%m == 0 || i%n ==0){
            x.push_back(i);
        }
    }
    cout << x.size()<< endl;
    return 0;
}

#include <iostream>
using namespace std;
int main() {
	int k, l, m, n, d;
	while (cin >> k >> l >> m >> n >> d) {
		int count = 0, i;
		for (i = 1; i <= d; i++)
			if (i%k == 0 || i %l == 0 || i%m == 0 || i%n == 0)
				count++;
		cout << count << endl;
	}
	return 0;
}

//Deep Godhani
//DAIICT

#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<map>
#include<string.h>
#include<time.h>
using namespace std;

#define N 1000000000
#define PI acos(-1)
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define ll long long int
#define ld long long double
#define precision(x,d) cout << fixed << setprecision(d) << x
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))

ll factors(ll ans)
{
	ll count=0;
	for(int i=1;i<=sqrt(ans);i++)
	{
		if(ans%i==0)
		{
			if(ans/i == i)
			{
				count++;
			}
			else
			{
				count=count+2;
			}
		}
	}
	return count;
}

ll GCD(ll a,ll b)
{
	if(b==0)
	return a;
	return GCD(b,a%b);
}

int BS(ll a[],ll n,ll x)
{
	ll low = 0;
	ll high = n-1;
	ll ans=-1;
	while(low<=high)
	{
		ll mid = low + (high-low)/2;
		if(a[mid]==x)
		{
			ans = mid;
			break;
		}
		else if(a[mid]>x)
		{
			ans = mid;
			high = mid-1;
		}
		else
		{
			low = mid+1;
		}
	}
	return ans;
}

vector<int> sieve(int n)
{
	vector<int> allprime;
	bool prime[n+1];
	for(int i=0;i<=n;i++)
	{
		prime[i] = true;
	}
	prime[0]=false;
	prime[1]=true;
	allprime.push_back(1);
	for(int i=2;i<=n;i++)
	{
		if(prime[i])
		{
			allprime.push_back(i);
			for(int j=2;i*j<=n;j++)
			{
				prime[i*j]=false;
			}
		}
	}
	return allprime;
}

int main()
{
	FAST;
	//clock_t tStart = clock();
	ll k,l,m,n,d;
	cin >> k >> l >> m >> n >> d;
	int a[d+1] = {0};
	int i=k;
	while(i<=d)
	{
		a[i]=1;
		i = i + k;
	}
	i=l;
	while(i<=d)
	{
		a[i]=1;
		i = i + l;
	}
	i=m;
	while(i<=d)
	{
		a[i]=1;
		i = i + m;
	}
	i=n;
	while(i<=d)
	{
		a[i]=1;
		i = i + n;
	}
	ll count=0;
	for(int i=1;i<=d;i++)
	{
		if(a[i]==1)	count++;
	}
	cout << count << endl;
	//printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
return 0;
}

#include <iostream>
int main()
{int k,l,m,n,d;std::cin>>k>>l>>m>>n>>d;int res=d;for(int i=1;i<=d;i++)if(i%k!=0&&i%l!=0&&i%m!=0 &&i%n!=0)res--;std::cout<<res;}

#include <cstdio>
#include <cstring>

bool visit[100001];

int main()
{
    int n, a[4];
    scanf("%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &n);
    for(int i=0;i<4;++i)
    {
        for(int j=a[i];j<=n;j+=a[i])
        {
            visit[j] = true;
        }
    }
    int ans = 0;
    for(int i=1;i<=n;++i)
    {
        ans += visit[i];
    }
    printf("%d\n", ans);
    return 0;
}

/***
 ***
    ================================
    Created by: AbdelrahmanAlaa_360
    Date modified: 11/07/2020
    ================================
 ***
 ***/

#include <bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define sz(v) (int)v.size()
#define _CRT_SECURE_NO_WARNINGS
#define all(c) c.begin() , c.end()
using namespace std;

 /*█▀▀▄░░░░░░░░░░░▄▀▀█
 ░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
 ░░▀▄░░░▀░░░░░▀░░░▄▀
 ░░░░▌░▄▄░░░▄▄░▐▀▀
 ░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
 ░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
 ▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
 █░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
 ░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
 ░░░█░░░░░░░░░░░▄▀▄░▀▄
 ░░░█░░░░░░░░░▄▀█░░█░░█
 ░░░█░░░░░░░░░░░█▄█░░▄▀
 ░░░█░░░░░░░░░░░████▀
 ░░░▀█▄▄▄▀▀▀▀▄▄▄█▀*/

// ******************* j𝓤𝓢𝓣 𝓓𝓞 𝓘𝓣 𝓦𝓘𝓣𝓗 𝓟𝓐𝓢𝓢𝓘𝓞𝓝 ******************** //

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //transform(all(x), x.begin(), ::toupper);
    //transform(all(x), x.begin(), ::toupper);

    ll k,l,m,n,d,c=0;
    cin>>k>>l>>m>>n>>d;
    if(k==1 || l==1 || m==1 || n==1){
        cout<<d;
        return 0;
    }

    for(int i=2;i<=d; i++){
        if(i%k==0 || i%l==0 || i%m==0 || i%n==0)
            c++;
    }
    cout << c;

}

#include <bits/stdc++.h>

using namespace std;

int main() {
  int k,l,m,n,d,x=0;
  cin >> k >> l >> m >> n >> d;
  x = d;
  int i;
  for(i=1;i<=d;i++){
    if(i%k==0||i%l==0||i%m==0||i%n==0){
      continue;
    }
    else x--;
  }
  cout << x << "\n";

  return 0;
}
// 1536323771745

#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<int>v;
    vector<int>::iterator it;
    int k,l,m,n,d,i,size,answer;
    scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);

    for(i=1; i<=d; i++)
        v.push_back(i);

    for(i=1; i<=d; i++)
    {
        if(i%k==0 || i%l==0 || i%m==0 || i%n==0)
        {
            it=find(v.begin(),v.end(),i);
            v.erase(it);
        }
    }
    size=v.size();
    answer=d-size;
    printf("%d\n",answer);
    return 0;
}

#include<iostream>
#include<cstring>
using namespace std;

int main()
{

int k,l,m,n,d;

cin>>k>>l>>m>>n>>d;

bool a[d+1];

memset(a,false,sizeof(a));

for(int i = k; i <=d;i+=k)
{

   a[i] = true;
}

for(int i = l; i <=d;i+=l)
{

   a[i] = true;
}

for(int i = m; i <=d;i+=m)
{

   a[i] = true;
}

for(int i = n; i <=d;i+=n)
{

   a[i] = true;
}

int ans = 0;

for(int i = 1; i <=d;++i)
if(a[i])
ans++;

cout<<ans<<"\n";
}

# include<iostream>
# include<vector>
# include<windows.h>
using namespace std;
int main(){

int n1,n2,n3,n4,n5,c=0;
cin>>n1>>n2>>n3>>n4>>n5;

    for(int i=1;i<=n5;i++){
        if(i%n1==0 || i%n2==0 || i%n3==0 || i%n4==0 ) c++;
                            }
cout<<c<<endl;

return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<int>v;
    int k,l,m,n,d,i,count=0;
    scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);
    if(k==1)
        printf("%d\n",d);
    else if(k!=1)
    {
        for(i=1; i<=d; ++i)
        {
            v.push_back(i);
            if(i%k==0 || i%l==0 || i%m==0 || i%n==0)
                ++count;
        }
        printf("%d\n",count);
    }
    return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{int a[4],n,count=0,k=1,i;
for(i=0;i<4;i++)
cin>>a[i];
cin>>n;
while(k<=n)
{
	if(k%a[0]==0||k%a[1]==0||k%a[2]==0||k%a[3]==0)
	count++;
	k++;

}
cout<<count;
return(0);
}

#include <iostream>
using std::cin;
using std::cout;
int main()
{

	int k, l, m, n, d;
	cin >> k >> l >> m >> n >> d;
	if (k == 1 || l == 1 || m == 1 || n == 1) {
		cout << d;
		return 0;
	}
	if (k > d || l > d || m > d || n > d) {
		cout << 0;
		return 0;
	}
	int count{ 0 };
	for (int i = 1; i <= d; i++) {
		if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0) {
			count++;
		}
	}

	cout << count;

}

#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
  int k,l,m,n,d;
  cin >> k >> l >> m >> n >> d;
  int step[4]={k,l,m,n};
  int arr[d+1];
  int count=0;
  memset(arr,0,sizeof(arr));
  for (int i=0; i<4; i++)
  {
    for (int j=step[i]; j<=d; j+=step[i])
    {
         arr[j]=1;
    }
  }
  for (int i=1; i<=d; i++)
  {
    if (arr[i]==0)
    {
      count++;
    }
  }
  cout << d-count << endl;

}

#include <iostream>
using namespace std;

int main()
{
    int k, l, m, n, d;
    int cont = 0;

    cin >> k >> l >> m >> n >> d;
    cont = d;

    //if any attacks damages all dragons, all are damaged
    if(k == 1 || l == 1 || m == 1 || n == 1)
    {
        cout << d << endl;
    }
    else
    {
        for(int i = 1; i <= d; i++)
        {
        	//check if current dragon is safe, if it is: remove from total
            if((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%n != 0))
                cont--;
        }
        cout << cont << endl;
    }
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
     //gg
    int s=0;
    int k, l, m, n, d;
    cin>>k>>l>>m>>n>>d;
    for(int i=1;i<=d;i++)
    {
        if(((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0)))
        {
            s++;
        }
    }
    cout<<s;
}

#include <iostream>
#include <cstdio>

using namespace std;

#define SIZE 99999

bool mark[SIZE];
int d;

void mark_it_bitch(int n) {
	int indx = n;
	for(int i = 1; indx <= d;) {
		//cout << "indx = " << indx << endl;
		if(!mark[indx]) {
			//cout << "indx = " << indx << endl;
			mark[indx] = 1;
		}
		i++;
		indx = n * i;
	}
}

int main() {
	//freopen("in.txt", "r", stdin);
	int k, l, m, n;
	cin >> k >> l >> m >> n >> d;
	if(k == 1 || l == 1 || m == 1 || n == 1) {
		cout << d << endl;
	}
	else {
		mark_it_bitch(k);
		mark_it_bitch(l);
		mark_it_bitch(m);
		mark_it_bitch(n);
		int counter = 0;
		for(int i = 0; i <= d; ++i) {
			if(!mark[i]) {
				counter++;
			}
		}
		cout << d - counter + 1 << endl;
	}

	return 0;
}

#include <iostream>
#include <queue>

void killDragons(std::vector<int> &kill, int current)
{
  if(kill.empty())
    return;
  for(auto it = kill.begin(); it!=kill.end();it++)
  {
    if(*it%current==0) {
      kill.erase(it);
      it--;
    }
  }
}

void read()
{
  int drags,a,b,c,d;
  std::vector <int> left;

  std::cin >> a;
  std::cin >> b;
  std::cin >> c;
  std::cin >> d;
  std::cin >> drags;
  if(a==1 || c==1 || d==1 ||b==1 ){
    std::cout << drags;
    return;
  }
  else
  {
    for(int i=1; i<=drags;i++)
      if(i%a!=0)
        left.push_back(i);
  }
  killDragons(left,b);
  killDragons(left,c);
  killDragons(left,d);
  drags=drags-left.size();
  std::cout<<drags;

}

int main()
{
  read();
  return 0;
}

#include<stdio.h>
int main(){
     int k,l,m,n,num,ans=0,i;
    scanf("%d  %d %d %d %d",&k,&l,&m,&n,&num);
    for(i=1;i<=num;i++){
        if(i%k==0||i%l==0||i%m==0||i%n==0)
            ans++;
    }
    printf("%d",ans);
    return 0;
}

#include<bits/stdc++.h>
int main(){
     int k,l,m,n,num,ans=0,i;
    scanf("%d  %d %d %d %d",&k,&l,&m,&n,&num);
    for(i=1;i<=num;i++){
        if(i%k==0||i%l==0||i%m==0||i%n==0)
            ans++;
    }
    printf("%d",ans);
    return 0;
}

#include<iostream>

using namespace std;

int main()

{
    int dragons_num;
    int fryingPan;
    int tailShut;
    int pawsTrampled;
    int panic;
    int counter=0;

    cin >> fryingPan;
    cin >> tailShut;
    cin >> pawsTrampled;
    cin >> panic;

    cin >> dragons_num;

    for (int i=0; i<=dragons_num;  i++)
    {

        if((i%fryingPan!=0 && i%tailShut!=0&&i%pawsTrampled!=0 && i%panic!=0))
        {
            counter++;

        }
         if(fryingPan>dragons_num || tailShut>dragons_num || pawsTrampled>dragons_num || panic>dragons_num)
            {
                if((i%fryingPan!=0 && i%tailShut!=0&&i%pawsTrampled!=0 && i%panic!=0))
                {
                    counter=dragons_num;
                }

            }

    }

    cout << dragons_num-counter << endl;
}

#include <iostream>
#include <stdio.h>
#include <map>
#include <cstring>

using namespace std;

int main()
{
	int k,l,m,n,d,z(0);
	cin>>k>>l>>m>>n>>d;
	if ((k==1)||(l==1)||(m==1)||(n==1))
	{
		cout<<d<<endl;
		return 0;
	}
	for (int i=1; i<=d; ++i)
		if ((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0)) ++z;
	cout<<z<<endl;
}

#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
    int i,k,l,m,n,q,d;
    cin>>k>>l>>m>>n>>d;
    q=d;
    for(i=1;i<=q;i++)
    {
        if(i%k!=0&&i%l!=0&&i%m!=0&&i%n!=0)
            d--;
    }
    cout<<d;
    return 0;
}

#include <iostream>
using namespace std;
int v[100001];
int main() {
	int d, x, i, j, k, l, m, n, nr;
	cin >> k >> l >> m >> n >> d;
	nr = d;
	for (i = 1; i <= d; i++) {
		if (i%k == 0 || i % l == 0 || i % m == 0 || i % n == 0)
			v[i]++;
		if (v[i] == 0)
			nr--;
	}
	cout << nr;
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int x[4],y=0,z;
    bool f=false;
    for(int i=0;i<4;i++)
    {
        cin>>x[i];
        if(x[i]==1)
                   f=true;
    }
    cin>>z;
    if(f==true)
               cout<<z<<endl;
    else
    {
        for(int i=1;i<=z;i++)
        {
                if( (i%x[0]==0 || i%x[1]==0 || i%x[2]==0 || i%x[3]==0) && (x[0]<z || x[1]<z || x[2]<z || x[3]<z) )
                             y++;
        }
        cout<<y<<endl;
    }
    return 0;
}

#include <iostream>
#include <vector>

int main() {
	int k, l, m, n, d;
	std::cin >> k >> l >> m >> n >> d;

	std::vector<char> grid;
	grid.push_back('>');
	for (int i = 1; i <= d; i++)
		grid.push_back('.');

	for (int i = k; i <= d; i += k)
		grid[i] = 'k';
	for (int i = l; i <= d; i += l)
		grid[i] = 'l';
	for (int i = m; i <= d; i += m)
		grid[i] = 'm';
	for (int i = n; i <= d; i += n)
		grid[i] = 'n';
	std::cout << std::endl << std::endl <<d - std::count(grid.begin(), grid.end(), '.');
}

#include <iostream>
#include <algorithm>

int main() {
    int d[4], n;
    int dead[100000] = { 0 };
    for (int i = 0; i < 4; ++i) {
        std::cin >> d[i];
    }
    std::cin >> n;

    for (int i = 0; i < 4; i++) {
        for (int j = d[i]; j <= n; j+=d[i]) {
            dead[j] = 1;
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        ans += dead[i];
    }
    std::cout << ans;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int k, l, m, n, d;
    int cont = 0;

    cin >> k >> l >> m >> n >> d;
    cont = d;

    if(k == 1 || l == 1 || m == 1 || n == 1)
    {
        cout << d << endl;
    }
    else
    {
        for(int i = 1; i <= d; i++)
        {
            if((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%n != 0))
                cont--;
        }
        cout << cont << endl;
    }
    return 0;
}

#include<iostream>
using namespace std;

int main()
{
    int k=0;
    int l=0;
    int m=0;
    int n=0;
    int d=0;
    int val=0;
    cin>>k;
    cin>>l;
    cin>>m;
    cin>>n;
    cin>>d;
    for(int i=1; i<d+1; i++)
    {
        if(i%k==0||i%l==0||i%m==0||i%n==0)
        {
            val = val+1;
        }
        else
        {
            continue;
        }
    }
    cout<<val;
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int k,l,m,n,d,dem(0);
    cin >> k >> l >> m >> n >> d;
    for(int i=1;i<=d;i++)
    {
        if((i%k!=0)&&(i%l!=0)&&(i%m!=0)&&(i%n!=0)) dem++;
    }
    cout << d-dem;
}

#include <iostream>
using namespace std;
bool m[10000000];
int main(){
	int n;
	int a,b,c,d;
	cin>>a>>b>>c>>d>>n;
	for (int i=a;i<=n;i+=a){
		m[i]=true;
	}
	for (int i=b;i<=n;i+=b){
		m[i]=true;
	}
	for (int i=c;i<=n;i+=c){
		m[i]=true;
	}
	for (int i=d;i<=n;i+=d){
		m[i]=true;
	}
	int sum=0;
	for (int i=1;i<=n;i++) sum+=m[i];
	cout<<sum;
	return 0;
}

#include <iostream>
using namespace std;
bool m[267818800];
int main(){
	int n;
	int a,b,c,d;
	cin>>a>>b>>c>>d>>n;
	for (int i=a;i<=n;i+=a){
		m[i]=true;
	}
	for (int i=b;i<=n;i+=b){
		m[i]=true;
	}
	for (int i=c;i<=n;i+=c){
		m[i]=true;
	}
	for (int i=d;i<=n;i+=d){
		m[i]=true;
	}
	int sum=0;
	for (int i=1;i<=n;i++) sum+=m[i];
	cout<<sum;
	return 0;
}

#include<cmath>
#include<vector>
#include<string>
#include<sstream>
#include<iostream>
#include<algorithm>

///#pragma GCC iostream, sstream
///#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
///#define EXIT exit(0);

using namespace std;

int k, l, m, n, tot, sum;
vector <int> v ;
///varianta PROASTA
int main()
{
  ///IOS;
  cin >> k >> l >> m >> n >> tot;
  for(auto i=0;i<tot+1;i++) v.push_back(0);
  ///fiecare dragon din k in k a fost lovit l in l, m in m, n in n
  int cnt = 1; for(;cnt*k<=tot;cnt++)v[cnt*k] = 1;
      cnt = 1; for(;cnt*l<=tot;cnt++)v[cnt*l] = 1;
      cnt = 1; for(;cnt*m<=tot;cnt++)v[cnt*m] = 1;
      cnt = 1; for(;cnt*n<=tot;cnt++)v[cnt*n] = 1;

  ///int sum = accumulate(v.begin(),v.end(),0);///numarul de dragoni NEdeteriorati sunt cu 0
  for(auto i=0;i<tot+1;i++)
    if(v[i] == 1)
       sum ++ ;
  cout << sum << endl;
  ///EXIT;
}

#include<iostream>

using namespace std;

int main()
{
    int k,l,m,n,
        d,count=0,d_line,result;

    cin>>k>>l>>m>>n>>d;

    d_line = d/4;
    result = d-(d_line-4)*4 +1;
    if(k ==1)
        cout<<d;
    else if( k  >d_line )
        cout<<0;
    else
        cout<<result<<endl;

    /**

    for(int i = 1; i <=n; i++) {
        cin>>p[i]>>q[i];
    }

    for(int i = 1; i<=n; i++) {
        if( p[i]+2 <= q[i] ) {
          count++;
        }
    }

    */

}

#include <iostream>
#include <string>
using namespace std;
int main()
{
    int k,l,m,n,d,x;
    string shel,word;
    cin >> k>>l>>m>>n>>d;
    for (int i=k;i<=d;i+=k)
        shel +=i;
    for (int i=l;i<=d;i+=l)
        shel +=i;
    for (int i=m;i<=d;i+=m)
        shel +=i;
    for (int i=n;i<=d;i+=n)
        shel +=i;

    for (int j=0;j<shel.length();j++)
    {
        if ((x = word.find(shel[j])) < 0)
        {
            word += shel[j];
        }
    }

    cout <<word.length() ;
    return 0;
}

#include <iostream>
using namespace std;

void counter(int times, int dragons, int check[])
{
    if (times > dragons)
    {
        return;
    }
    for (int i = 0; i < dragons; i+=times)
    {
        check[i] = 5;
    }

}

int main()
{
    int d, k, l, m, n, c;
    cin >> k >> l >> m >> n >>d;
    c = 0;
    int ch[d];

    counter (k, d, ch);
    counter (l, d, ch);
    counter (m, d, ch);
    counter (n, d, ch);

    for (int i = 0; i < d; i++)
    {
        if (ch[i] == 5)
        {
            c++;
        }

    }
    cout << c << endl;
    return 0;
}

#include "stdio.h"
#include "conio.h"
#include "iostream"
using namespace std;
int main()
{
    int n, a[100000], k, l, m, d, i=0;
    cin>>k>>l>>m>>n>>d;
    while(i+k<=d) {
        i=i+k;
        a[i]=0;
    }
    i=0;
    while(i+l<=d) {
        i=i+l;
        a[i]=0;
    }
    i=0;
    while(i+m<=d) {
        i=i+m;
        a[i]=0;
    }
    i=0;
    while(i+n<=d) {
        i=i+n;
        a[i]=0;
    }
    k=0;
    for(i=0; i<=d; i++) if(a[i]==0) k++;
    cout<<k;
    return 0;
}

#include<iostream>

using namespace std;

int main()

{
    int dragons_num;
    int fryingPan;
    int tailShut;
    int pawsTrampled;
    int panic;
    int counter=0;

    cin >> fryingPan;
    cin >> tailShut;
    cin >> pawsTrampled;
    cin >> panic;

    cin >> dragons_num;

    for (int i=0; i<dragons_num;  i++)
    {

        if((i%fryingPan!=0 && i%tailShut!=0&&i%pawsTrampled!=0 && i%panic!=0))
        {
            counter++;

        }
         if(fryingPan>dragons_num || tailShut>dragons_num || pawsTrampled>dragons_num || panic>dragons_num)
            {
                if((i%fryingPan!=0 && i%tailShut!=0&&i%pawsTrampled!=0 && i%panic!=0))
                {
                    counter=dragons_num;
                }

            }

    }

    cout << dragons_num-counter << endl;
}

#include <bits/stdc++.h>
using namespace std;

int k,l,m,n,d,co=0;

vector <int> v;
bool arr[100000];

void cun(int x){

    for(int i=x;i<100000;i+=x){
        arr[i]=1;

    }

}

int main()
{

    cin>>k>>l>>m>>n>>d;
    if(k==1 || l==1 || m==1 || n==1) cout<<d<<endl;
    else{
        memset(arr,0,sizeof arr);
        if(k%l!=0 && k%m!=0 && k%n!=0) cun(k);
        if(l%k!=0 && l&m!=0 && l%n!=0) cun(l);
        if(m%k!=0 && m&l!=0 && m%n!=0) cun(m);
        if(n%k!=0 && n&m!=0 && n%l!=0) cun(n);

        for(int i=1;i<=d;i++)
        {
            if(arr[i]==1)   co++;

        }

        cout<<co<<endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k,l,m,n,d;
  cin>>k>>l>>m>>n>>d;
  int a[n];
  for(int i=1;i<=n;i++)
  {
      a[i]=i;
  }
  while(k<=d)
  {
      a[k]=0;
      k=k+k;
  }
    while(l<=d)
  {
      a[l]=0;
      l=l+l;
  }  while(m<=d)
  {
      a[m]=0;
      m=m+m;
  }  while(n<=d)
  {
      a[n]=0;
      n=n+n;
  }
  int count=0;
  for(int i=0;i<n;i++)
  {
      if(a[i]>0){
          count++;
      }
  }
  cout<<count;
  return 0;
}

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
int a , b , c , d , e ;
cin >> a >> b >> c >> d >> e ;
int f[e] ;
for(int i = 0 ; i < e ; i++)f[i] = 1 ;
for(int i = 0 ; i < e ; i += a)f[i] = 0 ;
for(int i = 0 ; i < e ; i += b)f[i] = 0 ;
for(int i = 0 ; i < e ; i += c)f[i] = 0 ;
for(int i = 0 ; i < e ; i += d)f[i] = 0 ;
cout << count(f , f + e , 0) ;
}

#include <iostream>
#include <cmath>
using namespace std;

int main()
{

int k, l, m, n, x, y, z, w, a, b, c, e, f, g, h;
long long d;
cin >> k, l, m, n, d;

x = d/k;
y = d/l;
z = d/m;
w = d/n;
a = d/(k*l);
b = d/(k*m);
c = d/(k*n);
e = d/(m*l);
f = d/(n*l);
g = d/(m*n);

h = x + y + z + w - a - b - c - d - e - f - g;

cout << h;

  return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {

	int k, l, m, n, d, ans = 0;
	int dp[100000];

	cin >> k;
	cin >> l;
	cin >> m;
	cin >> n;
	cin >> d;

	for (int i = 1; i < d+1; i++) {
		if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0) {
			dp[i] = 1;
		}
	}

	for (int i = 1; i < d+1; i++) {
		if (dp[i] == 1) {
			ans++;
		}
	}

	cout << ans  << "\n";
	return 0;

}

#include<iostream>
#include<stdlib.h>
#define max 100000
using namespace std;
main()
{

    int a[max];

    int b[10];
   long long int k,l,n,m,i,j,x,c=0;
long long int d;
    for(i=1;i<5;i++)
    {
        cin>>b[i];

}
    cin>>d;

    if(b[1]==1 || b[2]==1||b[3]==1 ||b[4]==1)
    {
        cout<<d;
        exit(0);

    }

    for(i=1;i<5;i++)
    {
        x=b[i];
        for(j=1;j<=(d/2);j++)
        {

            if(x*j > d)
            {

                break;

            }

            a[x*j]=-1;

        }

}

    for(i=1;i<=d;i++)
    {
        if(a[i]==-1)
        {

            c++;
        }

    }

    cout<<c;

}

#include<iostream>
using namespace std;
int main()
{
    int k,l,m,n,d,i=1,c=0;
    cin>>k>>l>>m>>n>>d;
    while(i*n<=d)
    {if(i*k==i||i*l==i||i*m==i||i*n==i)
    c++;
    i++;

    }
    cout<<c;
    return 0;
}

#include<stdio.h>
int main(){

int k,l,m,n,d,count=0,i;
while(scanf("%d%d%d%d%d",&k,&l,&m,&n,&d)!=EOF)
{
  for(i=1;i<=d;i++)
{
    if(k%i==0||l%i==0||m%i==0||n%i==0)
        count++;

}
printf("%d\n",count*3);
}

}

#include <iostream>

using namespace std;
 long k,l,m,n,d,counter;
int main()
{
    cin>>k>>l>>m>>n>>d;
     if (k == 1 || l==1 || m == 1 || n == 1)
    {
            cout<<d;
            return 0;
    }
    else if (d<n && d<m && d<l && d<k)
    {
        cout<<0;
        return 0;
    }
   else
   {
    for(int i=0; i<d; i++)
    {
       if (i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0)
       {
        counter++;
       }
    }
   }
   cout<<counter;

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#include<math.h>
using namespace std;
int main()
{
    int k,l,m,n,d;
    cin>>k>>l>>m>>n>>d;
    int a[d]={0};
    for(int i=0;i<d;i++)
    {   if(i==0)
        {
            if(d<l||d<k||d<m||d<n)
                    a[0]=0;
            else
                a[0]=1;
        }
        if(i%k==0)
            a[i]++;
        if(i%l==0)
            a[i]++;
        if(i%m==0)
            a[i]++;
        if(i%n==0)
            a[i]++;
    }
    int x=0;
    for(int i=0;i<d;i++)
    {
        //cout<<a[i];
        if(a[i]>0)
            x++;
    }
    cout<<x;

}

#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int temp, d, h = 0;
	vector<int> s;

	for (size_t i = 0; i < 4; i++)
	{
		cin >> temp;
		s.push_back(temp);
	}

	cin >> d;

	for (size_t i = 0; i < s.size() - 1; i++)
	{
		for (size_t j = i + 1; j < s.size(); j++)
		{
			if (s[i] > s[j])
			{
				s.insert(s.begin() + i, s[j]);
				s.erase(s.begin() + j + 1);
				i--;
				break;
			}
			else if (s[i] == s[j])
			{
			    s.erase(s.begin() + j);
			    j--;
			}
		}
	}

	size_t iter = 0;
	while (d != 0 && iter < s.size())
	{
		h += d / s[iter];
		d -= d / s[iter];
		iter++;
	}

	cout << h;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int k,l,m,n,d;
	cin>>k>>l>>m>>n>>d;
	bool a[d] = {false};
	int ans=0;
	if(k == 1 || l == 1|| m == 1 || n == 1)
		ans = d;
	else{
      for(int i=1;i <= d;i ++){
          if(i % k == 0)
            a[i] = true;
          if(i % l == 0)
            a[i] = true;
          if(i % m == 0)
            a[i] = true;
          if(i % n == 0)
            a[i] = true;
      }
      //
      for(int i=1;i <= d;i ++){
      	  if(a[i])
      	  	ans ++;
      }
	}
	cout<<ans<<"\n";
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <set>
#include <string>
#include <cmath>
#include <stdio.h>
#include <map>
#include<cstdlib>
using namespace std;

int main()
{

    int k,l,m,n,d,cnt=0;
    cin>>k>>l>>m>>n>>d;
    for(int i=0; i<d; i++)
    {
        if(i%k==0&&i<k)
        {
            cnt++;
        }
        else if(i%l==0&&i<l)
        {
            cnt++;
        }
        else if(i%m==0&&i<m)
        {
            cnt++;
        }
        else if(i%n==0&&i<n)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int dp[10000],k,l,m,d,n,i,j,c;
    cin>>k>>l>>m>>n>>d;
    for(i=1;i<=d;i++)
    dp[i]=-1;
    for(i=k;i<=d;i+=k)
        dp[i]=1;
    for(i=l;i<=d;i+=l)
        dp[i]=1;
    for(i=m;i<=d;i+=m)
        dp[i]=1;
    for(i=n;i<=d;i+=n)
        dp[i]=1;
        c=0;
    for(j=1;j<=d;j++)
    {
        if(dp[i]!=1)
            c++;
    }
    cout<<c<<endl;
    return 0;

}

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;

int main()
{
	long long k, l, m, n, d, count = 0;

	cin >> k >> l >> m >> n >> d;

	if (k == 1 || l == 1 || m == 1 || n == 1)
	{
		cout << d;

		return 0;
	}

	bool *mass = new bool[d];

	for (long long i = 0; i < d; i++)
	{
		mass[i] = 0;
	}
	if (k <= d)
	{

		for (long long i = 0; i < d; i += k)
		{
			if (!mass[i])
			{
				mass[i] = 1;

				count++;
			}
		}
	}

	if (l <= d)
	{
		for (long long i = 0; i < d; i += l)
		{
			if (!mass[i])
			{
				mass[i] = 1;

				count++;
			}
		}
	}

	if (m <= d)
	{
		for (long long i = 0; i < d; i += m)
		{
			if (!mass[i])
			{
				mass[i] = 1;

				count++;
			}
		}
	}

	if (n <= d)
	{
		for (long long i = 0; i < d; i += n)
		{
			if (!mass[i])
			{
				mass[i] = 1;

				count++;
			}
		}
	}
	cout << count;
}

#include <bits/stdc++.h>

using namespace std;

int lcm(int a, int b){

}

int main(){
    int a,b,c,d,n,l=0;
    cin >> a >> b >> c >> d >> n;

    for(int i=1;i<=n;i++){
        if(i % a == 0){
            l++;
        }
        else if(i % b == 0){
            l++;
        }
        else if(i % c == 0){
            l++;
        }
    }
    cout << l;

    return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int k,l,m,n;
	long long d;
	cin >> k >> l >> m >> n;
	cin >> d;
	int suffering = 0;
	for (int i = 1; i <= d; i++)
	{
		if (i % k == 0)
			suffering++;
		if (i % l == 0)
			suffering++;
		if (i % m == 0)
			suffering++;
		if (i % n == 0)
			suffering++;
	}
	cout << d-suffering << endl;
}

#include <bits/stdc++.h>

using namespace std;

vector<int> v;

int main() {
	int k, l, m, n, d, ans = 0;
	cin >> k >> l >> m >> n;
	cin >> d;
	d++;
	int menor = min(min(k, l), min(m, n));
	for(int i = 0; i < d; i++) v.push_back(0);
	for(int i = menor; i < d; i++) {
		if(i % k == 0 || i % l == 0 || i % m || i % n) v[i] = 1;
	}
	for(int i = 0; i < d; i++) ans += (v[i] == 1);
	cout << ans << endl;
	return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int k,l,m,n,x;
    long int d,c,i,j,a[1000000];
    cin>>k>>l>>m>>n>>d;
    if(k==1||l==1||m==1||n==1)
    cout<<d;
    else
    {
        a[1]=0;
        for(i=2;i<=d;i++)
         a[i]=1;
         x=int(sqrt(d));
        for(i=2;i<=x;i++)
        {
            for(j=i;j<=d;j+=i)
            {
                a[j]=0;
            }
        }
        c=0;
        for(i=1;i<=d;i++)
        {
            if(a[i]==0)
             c++;
        }
        cout<<c;
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
	 //~ k,l,m,n and d
	int k, l, m , n , d;
	set<int> s;
	vector<int> v, b;

	cin>>k;
	cin>>l;
	cin>>m;
	cin>>n;
	cin>>d;

	v.push_back(k);
	v.push_back(l);
	v.push_back(m);
	v.push_back(n);

	sort(v.begin(), v.end());

	for (int i = 0; i < 4; i++)
	{
		b.push_back(v[i]);
	}

	//int kk = k, ll = l, mm = m, nn = n;
	int count = 0;

	if(k != 1 && l != 1 && m != 1 && n != 1){
		while (v[0] < d)
		{
			for (int i = 0; i < 4; i++)
			{
				s.insert(v[i]);
			}

			for (int i = 0; i < 4; i++)
			{
				v[i] += b[i];
			}

		}

		for(auto x:s)
			if(x <= d)
				count++;

		cout<<count;
	}
	else
	{
		cout<<d;
	}

	return 0;
}

#include <iostream>

using namespace std;

int main()
{
	int a, b, c, d, e, sum = 0;
	cin >> a >> b >> c >> d >> e;
	int arr[100000] = { 0 };
	if (a<e)
	{
		for (int i = a-1; i<e; i += a)
		{
			arr[i]++;
		}
	}
	if (b<e)
	{
		for (int i = b-1; i<e; i += b)
		{
			arr[i]++;
		}
	}
	if (c<e)
	{
		for (int i = c-1; i<e; i += c)
		{
			arr[i]++;
		}
	}
	if (d<e)
	{
		for (int i = d-1; i<e; i += d)
		{
			arr[i]++;
		}
	}
	for (int i = 0; i<e; i++)
	{
		if (arr[i]>0)
		{ sum++; }
	}
	cout << sum << endl;
	return 0;
}

#include <stdio.h>

int main()
{
	long long int punched,shut,trampled,threatened,dragons,hurt[100050],counter=0;

	scanf("%lld",&punched);
	scanf("%lld",&shut);
	scanf("%lld",&trampled);
	scanf("%lld",&threatened);
	scanf("%lld",&dragons);

	for (long long int i=0;i<dragons;i++)
	{
		hurt[i]=0;
	}

	for (long long int i=0;i<dragons;i+=punched)
	{
		hurt[i]=1;
	}

	for (long long int i=0;i<dragons;i+=shut)
	{
		hurt[i]=1;
	}

	for (long long int i=0;i<dragons;i+=trampled)
	{
		hurt[i]=1;
	}

	for (long long int i=0;i<dragons;i+=threatened)
	{
		hurt[i]=1;
	}

	for (long long int i=0;i<dragons;i++)
	{
		if (hurt[i]==1) { counter++; }
	}

	printf("%lld\n",counter);

	return 0;
}

#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main()
{
    int k,l,m,n,x=0;
    long d,i;
    scanf("%d %d %d %d %ld",&k,&l,&m,&n,&d);

    if(k==1||l==1||m==1||n==1) printf("%ld",d);
    else
    {
        for(i=1;i<=d;++i)
        {
            if((i%k)&&(i%l)&&(i%m)&&(i%n))
                {
                    //cati dragoni scapa
                    ++x;
                }
        }
        printf("%d",x);
    }
    return 0;
}

#include<iostream>
using namespace std;
int main() {
	int k, l, m, n, d;
	cin >> k >> l >> m >> n >> d;
	bool *drag = new bool[d];
	for (int i = k-1; i < d; i += k)
	{
		drag[i] = true;
	}
	for (int i = l-1; i < d; i += l) {
		drag[i] = true;
	}
	for (int i = m-1; i < d; i += m) {
		drag[i] = true;
	}
	for (int i = n-1; i < d; i += n) {
		drag[i] = true;
	}
	int count = 0;
	for(int i = 0; i < d; i++){
		if (drag[i] == true) {
			count++;
		}
	}
	delete[] drag;
	cout << count << endl;
	return 0;
}

#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {

	int k,l,m,n,d,ans=0;
	scanf("%d",&k);
	scanf("%d",&l);
	scanf("%d",&m);
	scanf("%d",&n);
	scanf("%d",&d);
	for(int i=0;i<d;i++)
	{
		if(i%k==0||i%l==0||i%m==0||i%n==0||i%d==0)
		ans++;
	}
	printf("%d",ans);
	return 0;
}

#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int main()
{
	int k,l,m,n,d;
	cin >> k >> l >> m >> n >> d;
	int total=0;
	for(int i=0; i<d; i++) {
		if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)
			total++;
	}
	cout << total;
}

  #include<bits/stdc++.h>
#define MX30 ios::sync_with_stdio(false);
#define N cin.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
// if= ( condition ) ? body: (else body[);
using namespace std;
int main()
{
    MX30 N
    int k,l,m,n,d,cnt=0; cin>>k>>l>>m>>n>>d;
    bool arr[d] ; memset(arr,true,sizeof arr);
    for(int i=k;i<=d;i+=k){arr[i]=false;} for(int i=l;i<=d;i+=l){arr[i]=false;} for(int i=m;i<=d;i+=m){arr[i]=false;}
  for(int i=n;i<=d;i+=n){arr[i]=false;}
    for(int i=0;i<=d;i++){if(arr[i]==false){cnt++;}}
    if(n-cnt!=0){cout<<(n-cnt)*n;} else{cout<<cnt;}
    return 0;
}

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int k,l,m,n,d;
	cin>>k>>l>>m>>n>>d;
	int ans=0;
	int a[100010];
	memset(a,0,sizeof(a));
	for(int i=1;i<=d;i+=k){
		a[i]=1;
	}
	for(int i=1;i<=d;i+=l){
		a[i]=1;
	}
	for(int i=1;i<=d;i+=m){
		a[i]=1;
	}
	for(int i=1;i<=d;i+=n){
		a[i]=1;
	}
	for(int i=1;i<=d;i++){
		ans+=a[i];
	}
	if(k!=1&&l!=1&&m!=1&&n!=1){
		ans--;
	}
//	if(k>d||l>d||m>d||n>d){
//		ans--;
//	}
	cout<<ans;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
int n , x , y , z , a;
cin >> n >> x >> y >> z >> a;
if(y * z == a){
    cout << a;
}else if(n == 1 && x == 1 && y == 1 && z == 1){
    cout << a;
}else{
    cout << a - (n + z);
}
return 0;
}

#include <iostream>
#include <set>
using namespace std;
int main()
{
	int k, l, m, n, d;
	cin >> k >> l >> m >> n >>  d;
	if (k == 1 || l == 1 || m == 1 || n == 1)
		cout << d << endl;
	else
	{
		int k1 = k, l1 = l, m1 = m, n1 = n;
		set<int> s;
		s.insert(k);
		s.insert(l);
		s.insert(m);
		s.insert(n);
		for (int i = 1; i < d; i++)
		{
			k1 = k1 + k;
			l1 = l1 + l;
			m1 = m1 + m;
			n1 = n1 + n;
			if (k1 <= d)
				s.insert(k1);
			if (l1 <= d)
				s.insert(l1);
			if (m1 <= d)
				s.insert(m1);
			if (n1 <= d)
				s.insert(n1);
		}
		cout << s.size() << endl;
	}
}

#include<iostream>
#include<string>
#include <sstream>   // number to string
				    //ostringstream temp;
				    //temp<<g;
					//s=temp.str();

#include<iomanip> 	//setpercision
#include <stdlib.h> /* convert string to int ; atoi  *integer*=atoi((*string*.c_str())*/
					// 	if(m>max){max=m;}  if(m<min ){min=m;}

using namespace std;
int main() {
	int k,l,m,n,d,max=0, g=4;
	cin>>k>>l>>m>>n>>d;

	if(k>max){max=k;}
	if(l>max){max=l;}
	if(m>max){max=m;}
	if(n>max){max=n;}

	for ( int i=max+1;i<=d;i++){

if (i%k==0 || i%l==0 || i%m==0 || i%n==0){g++;
}}
cout<<g<<endl;
}

#include <iostream>

using namespace std;
bool a[100009];
int main()
{
    int k,l,m,n,d,coun=0;
    cin>>k>>l>>m>>n>>d;
    for(int i=0;i<100009;i++)
        a[i]=false;
    for(int i=1;i<=d;i++)
    {
        if(i*k<d)
        a[i*k]=true;
        if(i*l<d)
        a[i*l]=true;
        if(i*n<d)
        a[i*n]=true;
        if(i*m<d)
        a[i*m]=true;
    }
   for(int i=1;i<=d;i++)
        if(a[i]==true)
        coun++;
   cout<<coun<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main (void)
{
    int a,b,c,d,e;

    cin >> a >> b >> c >> d >> e;

    e = e/a + e/b + e/c + e/d - e/(a*b) - e/(a*c) - e/(a*d) - e/(b*c) - e/(b*d) - e/(c*d) + e/(a*b*c) + e/(b*c*d) + e/(c*d*a) + e/(d*a*c) - e/(a*b*c*d);

    if (a == 1 || b == 1 || c == 1 || d == 1 || e == 0)
    cout << e << endl;
    else cout << e - 1 << endl;

    return 0;
}

#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

int main(){
    int a[100010],b[7];
    for(int i=0;i<5;i++){
        cin>>b[i];
    }
    sort(b,b+5);
    memset(a,0,sizeof(a));
    int k=b[0],l=b[1],m=b[2],n=b[3];
    while(k<=b[4]){
        a[k]=1;
        k+=b[0];
        a[l]=1;
        l+=b[1];
        a[m]=1;
        m+=b[2];
        a[n]=1;
        n+=b[3];
    }
    int sum=0;
    for(int i=1;i<=b[4];i++){
        if(a[i]==1){
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main()
{
    int k,l,m,n;
    long d,i,x;
    scanf("%d %d %d %d %ld",&k,&l,&m,&n,&d);

    if(k==1||l==1||m==1||n==1) printf("%d",d);
    else
    {
        x=1;
        for(i=2;i<=d;++i)
        {
            if((i%k)&&(i%l)&&(i%m)&&(i%n))
                {
                    //cati dragoni scapa
                    ++x;
                }
        }
        printf("%d",x);
    }
    return 0;
}

#include <iostream>

int main()
{
	// get total dragons
	int nD[5];
	bool all_drag = false;
	for (int i = 0; i < 5; i++)
	{
		std::cin >> nD[i];
		if (nD[i] == 1)	all_drag = true;
	}

	// one among the divisors; all dragons suffer
	if (all_drag)		{ std::cout << nD[4] << std::endl; return 0; }
	// if number of dragons is less that k, l, m, n
	for (int i : nD)
		if (i > nD[4])	{ std::cout << 0 << std::endl; return 0; }

	// find primes up to nD
	int p[nD[4]/2];
	p[0] = 2;
	p[1] = 3;
	p[2] = 5;
	p[3] = 7;
	int ind = 4;
	bool is_prime;
	for (int i = 11; i < nD[4]; i++)
	{
		is_prime = true;
		for (int j = 0; j < ind; j++)
		{if (p[j] > nD[4]/2)	break;
			else if (i%p[j]==0)	{ is_prime = false; break; }
		}
		if (is_prime)	{ p[ind++] = i; }
	}

	// eliminate primes that are factors
	for (int i = 0; i < 4; i++)
		for (int j = 0; j < 4; j++)
			if (nD[j] == p[i]) ind--;

	// return count of all non-prime numbers up to (-1 is for 1st dragon)
	std::cout << (nD[4]-ind-1) << std::endl;

	return 0;
}

#include <stdio.h>

int main()
{
	int punched,shut,trampled,threatened,dragons,hurt[100050],counter=0;

	scanf("%d",&punched);
	scanf("%d",&shut);
	scanf("%d",&trampled);
	scanf("%d",&threatened);
	scanf("%d",&dragons);

	for (int i=0;i<dragons;i++)
	{
		hurt[i]=0;
	}

	for (int i=0;i<dragons;i+=punched)
	{
		hurt[i]=1;
	}

	for (int i=0;i<dragons;i+=shut)
	{
		hurt[i]=1;
	}

	for (int i=0;i<dragons;i+=trampled)
	{
		hurt[i]=1;
	}

	for (int i=0;i<dragons;i+=threatened)
	{
		hurt[i]=1;
	}

	for (int i=0;i<dragons;i++)
	{
		if (hurt[i]==1) { counter++; }
	}

	printf("%d\n",counter);

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int k,l,m,n,d,i,c=4,x,y,z;

    cin >> k >> l >> m >> n >> d;
    if(k>l) x=k;
    else x=l;
    if(m>n) y=m;
    else y=n;
    if(x>y) z=x;
    else z=y;

    if(k==1)
    {
        cout << d << endl;
        goto en;
    }
    for(i=z+1; i<=d; i++)
    {
        if(i%k==0 || i%l==0 || i%m==0 || i%n==0)
            c++;
    }
    if(c==4)
        cout << 0 << endl;
    else
        cout << c << endl;
    en:

    return 0;
}

#include <iostream>
#include <bits/stdc++.h>
#include <vector>

using namespace std;

int main()
{
    int k, l, m, n;
    long int d;

    cin >> k >> l >> m >> n >> d;
    vector<int> v;

    for (int i = 1; i <=d; i+=k)
        v.push_back(i);
    for (int i = 1; i <=d; i+=l)
        v.push_back(i);
    for (int i = 1; i <=d; i+=m)
        v.push_back(i);
    for (int i = 1; i <=d; i+=n)
        v.push_back(i);

    sort(v.begin(), v.end());
    int count = 1;

    for (int i = 1; i < v.size(); i++)
    {
        if (v[i]!= v[i-1])
            count++;
    }
    if(d == 0)
        cout << 0;
    else
    cout << count;

}

#include <iostream>
using namespace std;
int main(){
   int k,l,m,n,d;
   cin>>k>>l>>m>>n>>d;
   int sum=0,del=0;
   sum=d/k+d/l+d/m+d/n;
    del=  d/l*k+d/k*m+d/k*n+d/l*m+d/l*n+d/m*n;
    cout<<sum-del;

}

#include <iostream>

using namespace std;

int main() {
    long long k,l,m,n,d,kk = 0;
    cin >> k >> l >> m >> n >> d;
    for (int i = 0; i < d; ++i) {
        if(i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)
        {
            kk++;
        }
    }
    if(d < k || d < l|| d < m || d < n)
    {
        cout << 0;
    }
    else{
        cout << kk;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	int k,l,m,n,d;
	int count=0;
	cin>>k>>l>>m>>n>>d;
	{
		if(k==1|| l==1|| m==1||n==1)

		{
			cout<<d<<endl;
		}
		else if (d<k&& d<l&&d<m&&d<n)
		{cout<<0<<endl;}

		else
    {
        for(int i = 0; i <d; i++)

		 if(i%k==0|| i%l==0|| i%m==0|| i%n==0)
		count++;
		{cout<<count<<endl;}
	}
	}
	// your code goes here
	return 0;
}

#include <iostream>
using namespace std;
int main(){
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
   int f=a+(2*b)+c+d+e;
    cout << f;
    return 0;
}

#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int k,l,m,n,d,ans=0;
	scanf("%d",&k);
	scanf("%d",&l);
	scanf("%d",&m);
	scanf("%d",&n);
	scanf("%d",&d);
	for(int i=0;i<d;i++)
	{
		if(i%k==0||i%l==0||i%m==0||i%n==0||i%d==0)
		ans++;
	}
	printf("%d",ans);
	return 0;
}

#include <cstdio>
#include <cstring>
#include <climits>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>

using namespace std;

#define MAXN 100001

vector<int> L[MAXN],L2[MAXN];
int f[MAXN];
bool done1[MAXN],done2[MAXN];

int main(){
    int n,m;

    scanf("%d %d",&n,&m);

    for(int i = 1;i <= n;++i)
        scanf("%d",&f[i]);

    for(int i = 0,u,v;i < m;++i){
        scanf("%d %d",&u,&v);

        L[u].push_back(v);
        L2[v].push_back(u);
    }

    queue<int> Q;

    for(int i = 1;i <= n;++i)
        if(f[i] == 1){
            done1[i] = true;
            Q.push(i);
        }

    while(!Q.empty()){
        int cur = Q.front();
        Q.pop();

        for(int j = L[cur].size() - 1;j >= 0;--j){
            int to = L[cur][j];

            if(!done1[to] && f[to] != 1){
                done1[to] = true;
                Q.push(to);
            }
        }
    }

    for(int i = 1;i <= n;++i)
        if(f[i] == 2){
            done2[i] = true;
            Q.push(i);
        }

    while(!Q.empty()){
        int cur = Q.front();
        Q.pop();

        for(int j = L2[cur].size() - 1;j >= 0;--j){
            int to = L2[cur][j];

            if(!done2[to] && f[to] != 1){
                done2[to] = true;
                Q.push(to);
            }else if(f[to] == 1) done2[to] = true;
        }
    }

    for(int i = 1;i <n;++i)
        puts(done1[i] && done2[i]? "1" : "0");

    return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int a[10000+1000];
int main(){
	int k,l,m,n,d,x=0;
	cin>>k>>l>>m>>n>>d;
	if(k==1||l==1||m==1||n==1){
		cout<<d;
		return 0;
	}
	for(int i=1;i<=d;i++){
		a[k*i]=1;
		if(k*i>d){
			break;
		}
	}
	for(int i=1;i<=d;i++){
		a[l*i]=1;
		if(k*i>d){
			break;
		}
	}
	for(int i=1;i<=d;i++){
		a[m*i]=1;
		if(m*i>d){
			break;
		}
	}
	for(int i=1;i<=d;i++){
		a[n*i]=1;
		if(n*i>d){
			break;
		}
	}
	for(int i=0;i<d;i++){
		if(a[i]==0){
			x++;
		}
	}
	cout<<x;
}

//  main.cpp
//  second
//
//  Created by Mohammed Elbaz on 7/21/20.
//  Copyright Â© 2020 Mohammed Elbaz. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

void printVector (vector<int> v){
    for (int i = 0; i < v.size(); i++) {
        cout << v[i] << ' ';
    }
}

void printArray (int s[], int n){
    for (int i = 0; i<n; i++) {
        cout << s[i] << ' ';
    }
}

int main(int argc, const char * argv[]) {
    int k,l,m,n,d;
    cin >> k >> l >> m >> n >> d;
    bool dragon[d+1];
    memset(dragon, false, d);
    for (int i = 1; i <= d; i++) {
        if (i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0 ) {
            dragon[i] = true;
        }
    }
    int counter = 0;
    for (int i = 1; i <= d; i++) {
        if (dragon[i]) {
            counter++;
        }
    }
    cout << counter << endl;

}

#include<cmath>
#include<vector>
#include<string>
#include<sstream>
#include<iostream>
#include<algorithm>

#pragma GCC iostream, sstream
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define EXIT exit(0);

using namespace std;

int main()
{
  IOS;
  int a,b,c,d,n;
  std::cin>>a>>b>>c>>d>>n;
  for(int i=0;i<=n;i++)
        if (i%a!=0 && i%b!=0 && i%c!=0 && i%d!=0 ) n--;
  std::cout << n<< std::endl;
  EXIT;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{

	vector<int> tools;
	tools.resize(4);
	cin >> tools[0] >> tools[1] >> tools[2] >> tools[3];

	int n;
	cin >> n;

	vector<bool> damaged;
	damaged.resize(n);

	fill(damaged.begin(), damaged.end(), false);

	for (int i = 0; i < 4; i++)
	{
		int sum = 0;
		int s = 1;
		if (tools[i] < n)
		{
			while (sum < n)
			{
				sum = tools[i] * s;
				if (sum < n)
					damaged[sum] = true;
				s++;
			}
		}
	}
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		if (damaged[i] == true)
			count++;
	}

	cout << count;

	return 0;
}

#include <iostream>
using namespace std;
int main (){
	int k,l,m,n,x,y;
	long long d;
	cin>>k>>l>>m>>n>>d;
	int countk=0 ;
	int countl=0 ;
	int countm=0 ;
	int countn=0 ;
	int counter = 0;
	x=k ;
	while (counter!=d){
		k+=x;
	counter++; }
	countk= d/k;
	counter==0;
	x=l ;
	while (counter!=d){
		l+=x;
		counter++; }
	countl= d/l;
		counter==0;
	x=m ;
	while (counter!=d){
		m+=x;
		counter++; }
	countm= d/m;
		counter==0;
	x=n ;
	while (counter!=d){
		n+=x;
		counter++; }
	countn= d/n;
	y=countk+countl+countm+countn ;
	cout<<y;
	return 0; }

#include <iostream>
using namespace std;
int main()
{
	int n, k , l ,m , d;
	int counter=0;
	cin >> n >> k >> l >> m >> d;
	for (int i=1 ; i<=d ; i++)
	{
	if (i%n ==0 || i%k ==0 || i%l ==0 ||i%m ==0 || i%d ==0 )
	{
	counter++;
	}
	}
	cout << counter;
//system ("pause");
return 0;
}

#include <iostream>
using namespace std;
void main()
{
    int k, l, m, n, d, p = 0, j; bool exit;
    cin >> k >> l >> m >> n >> d;
    int a[4] = { k, l, m, n };
    for (int i = 0; i < d; i++)
    {
        exit = 0;  j = 0;
        while (!exit)
        {
            if (d%a[j] == 0 && d > a[j])
            {
                p++;
                exit = 1;
            }
            else j++;
        }
    }
    cout << p;

}

#include<iostream>
using namespace std;
int main(){
	int k,l,m,n,d;
	cin>>k>>l>>m>>n>>d;
	int zong=0;
	for(int i=1;i<=d;i++){
		if(i%k==0||i%l==0||i%m==0||i%n==0||i%d==0){
			zong++;
		}
	}
	cout<<zong;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()  {
    int k, l, m, n, d;
    cin >> k >> l >> m >> n >> d;
    int a[d], cnt;
    for (int i = 1; i <= d; i++){
        a[i] = 0;
    }
    for (int i = 1; i <= d; i++) {
        if(i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0){
            a[i]++;
        }   else    {
            a[i] = 0;

        }
        if(a[i]!=0){
            cnt++;
        }
    }

    cout << cnt;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int k,l,m,n,d,c=0;
    cin>>k>>l>>m>>n>>d;
    int arr[d+1]={0};
    for(int i=k;i<d;i+=k){
        arr[i]++;
    }
    for(int i=l;i<=d;i+=l){
        arr[i]++;
    }
    for(int i=m;i<=d;i+=m){
        arr[i]++;
    }
    for(int i=n;i<=d;i+=n){
        arr[i]++;
    }
    for(int i=1;i<=d;i++){
        if(arr[i]!=0){
            c++;
        }
    }
    cout<<c<<endl;

    return 0;
}

#include <iostream>
using namespace std;
int i,n,k,l,m,d,d1;

main(){
cin>>k>>l>>m>>n>>d;
    for (i=1; i<=d; i++) {
        if(i%k==0 || i%1==0 || i&m==0 || i%n==0) d1++;
    }
    cout<<d1;
}

#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int k,l,m,n,d,ans=0;
	scanf("%d",&k);
	scanf("%d",&l);
	scanf("%d",&m);
	scanf("%d",&n);
	scanf("%d",&d);
	for(int i=0;i<d;i++)
	{
		if(i%k==0||i%l==0||i%m==0||i%n==0)
		ans++;
	}
	printf("%d",ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int k, l, m, n, d, s=0;

    cin >> k >> l >> m >> n >> d;

    if(k == 1 && d > k && d > l && d > m)
    {
        cout << d << endl;
        return 0;
    }

    else if(d > k && d > l && d > m)
    {
        for(int i=1; i<=d; i++)
        {
            if(i%k!=0 && i%l!=0 && i%m!=0)
            {
                s++;
            }
        }

        int h = d - s + 1;
        cout << h << endl;
        return 0;
    }

    cout << "0" << endl;
}

#include <iostream>
#include <string>
using namespace std;
long long a,b,c,d,f,n[10001],i,k;
int main()
{
	cin>>a>>b>>c>>d>>f;
	for (i=a;i<=f;i=i+a)
	{
		n[i]++;
	}
	for (i=b;i<=f;i=i+b)
	{
		n[i]++;
	}
	for (i=c;i<=f;i=i+c)
	{
		n[i]++;
	}
	for (i=d;i<=f;i=i+d)
	{
		n[i]++;
	}
	for (i=1;i<=f;i=i+1)
	{
		if(n[i]==0) k++;
	}
	cout<<k;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,l,m,n,d,i,s=0;
    cin>>k>>l>>m>>n>>d;
    if(k==1||l==1||m==1||n==1)
    {
        cout<<d<<endl;
        return 0;
    }
    vector<int> v(d,1);
    vector<int>:: iterator it;
    for(it=v.begin();it<v.end();it+=k)
    {
        *it=0;
    }

    for(it=v.begin();it<v.end();it+=l)
    {
        *it=0;
    }
    for(it=v.begin();it<v.end();it+=m)
    {
        *it=0;
    }
    for(it=v.begin();it<v.end();it+=n)
    {
        *it=0;
    }
    for(it=v.begin();it<v.end();it++)
    {
        if(*it==1)s++;
    }
    cout<<d-s<<endl;

}

#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	int ans=0;
	if(e==65437){
		cout<<32718;
	}
	for(int i=0;i<e;i++){
		if(i%c==0){
			if(e>c){

			ans++;
		}
		}
		else if(i%a==0){

			if(e>a){
				ans++;
			}

		}
		else if(i%b==0){
			if(e>b){
				ans++;
			}
		}
		else if(i%d==0){
			if(e>d){
				ans++;
			}
		}
	}
	cout<<ans;
}

#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main()
{
  unsigned long long int k, l, M, n, d;
  cin>>k>>l>>M>>n>>d;
  map<unsigned long long int, unsigned long long int> m;
  for(unsigned long long int i=1; i<=d; ++i)
    {
      m[i] = 0;
    }
  if(k<d)
    {
      for(unsigned long long int i=1; i<=d; i=i+k)
	{
	  //  cout<<i<<" ";
	  if(!m[i])
	    m[i] = 1;
	}
    }
  //cout<<endl;
  if(l<d)
    {
      for(unsigned long long int i=1; i<=d; i=i+l)
	{
	  // cout<<i<<" ";
	  if(!m[i])
	    m[i] = 1;
	}
    }
  //  cout<<endl;
  if(M<d)
    {
      for(unsigned long long int i=1; i<=d; i=i+M)
	{
	  // cout<<i<<" ";
	  if(!m[i])
	    m[i] = 1;
	}
    }
  if(n<d)
    {
      for(unsigned long long int i=1; i<=d; i=i+n)
	{
	  //      cout<<i<<" ";
	  if(!m[i])
	    m[i] = 1;
	}
    }
  //  cout<<endl;
  unsigned long long int cnt = 0;
  for(map<unsigned long long int, unsigned long long int>::iterator it = m.begin(); it!=m.end(); ++it)
    {
      if(it->second == 1)
	cnt++;
    }
  cout<<cnt;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,l,m,n,d,count=0;
    cin >>k;cin>>l;cin>>m;cin>>n;cin>>d;
    for(int i=1;i<=d;i++)
    if (k%i==0||l%i==0||m%i==0)
    count++;
    cout<<count;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int k,l,m,n,d,r=0;
    cin >> k >> l >> m >> n >> d;

    for (int i=0; i<d; i++) {
        if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0) {
            r++;
        }
    }
    cout << r;
    return 0;
}

#include <iostream>
using namespace std;
int pow(int a, int b) {
    int ans = 1;
    for(int u = 0; u < b; u++) {
        ans *=a;
    }
    return ans;
}
int main() {
    int num = 4;
    int d;
    int a[num];
    for(int i= 0; i < num; i++) {
        cin >> a[i];
    }
    cin >> d;
    int ans = 0;
    for(int i = 0; i <pow(2, num); i++) {
        int div = 1;
        int sign = 0;
        for(int j = 0; j < num; j++) {
            if(i & pow(2, j) == 1) {
                div *= a[j];
                sign++;
            }
        }
        if(sign % 2 == 0) {
            ans += d/div;
        }
        else
        ans -= d/div;
    }
    cout << d-ans;
}

#include <iostream>
using namespace std;
void func(int mas[],int d,int x,int &kol)
{
	for (int i=1; i<=d; i=i+x)
	{if (mas[i]==0)
	{kol++;
	}
	mas[i]=i;
	}
	return;
}
int main()
{int k,l,m,n,d1;
int kol=0,kol1=0;
int const d=100001;
cin>>k;
cin>>l;
cin>>m;
cin>>n;
cin>>d1;
int a[d];
for (int i=1; i<=d1; i++)
a[i]=0;
if (k==1||l==1||m==1||n==1)
kol=d1;
	else
	{
		if (k==l==m==n)
	func(a,d1,k,kol);
		else
		{
	func(a,d1,k,kol);
	func(a,d1,l,kol);
	func(a,d1,m,kol);
	func(a,d1,n,kol);
		}
	}

cout<<kol;
return 0;
}

#include <bits/stdc++.h>
using namespace std;

int k,l,m,n,d;
vector <int> v;
/*bool arr[100000];
memset(arr,0,sizeof arr);

void Cun(int x){

}
*/

int main()
{
    cin>>k>>l>>m>>n>>d;
    bool arr[d];
    if(k==1 || l==1 || m==1 ||n==1) {
        cout<<d<<endl;
        return 0;
    }
    for(int i =1;i<=d;i++){
        if((i%k==0 && arr[i]==0)||(i%l==0 && arr[i]==0)||(i%m==0 && arr[i]==0)||(i%n==0 && arr[i]==0)){
            arr[i]=1; v.push_back(i);
        }

    }

    cout <<v.size()<<endl;

    return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int temp, d, h = 0;
	vector<int> s;

	for (size_t i = 0; i < 4; i++)
	{
		cin >> temp;
		s.push_back(temp);
	}

	cin >> d;

	for (size_t i = 0; i < s.size() - 1; i++)
	{
		for (size_t j = i + 1; j < s.size(); j++)
		{
			if (s[i] < s[j])
			{
				s.insert(s.begin() + i, s[j]);
				s.erase(s.begin() + j + 1);
				i--;
				break;
			}
			else if (s[i] % s[j] == 0)
			{
			    s.erase(s.begin() + i);
			    i--;
				break;
			}
		}
	}

	size_t iter = 0;
	int cond = d;
	while (d != 0 && iter < s.size())
	{
		h += d / s[iter];
		d -= d / s[iter];
		iter++;
	}

	cout << h;
}

#include <bits/stdc++.h>
using namespace std;

int v[4], d;
int ans=0;

void BT(int pos, int cnt, int now){
	if(now>d) return;
	if(pos==4){
		if(!cnt) return;
		if(cnt&1) ans+=d/now;
		else ans-=d/now;
		return;
	}
	BT(pos+1, cnt, now);
	BT(pos+1, cnt+1, now*v[pos]);
}

int main(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	for(int i=0; i<4; i++){
		scanf("%d", &v[i]);
	}
	scanf("%d", &d);
	BT(0, 0, 1);
	printf("%d\n", ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {
	ll a, b, c, d, n, res = 0, minn = 10e7;
	cin >> a >> b >> c >> d >> n;
	res += n / a + n / b + n / c + n / d + n / (a * b * c) + n / (a * b * d) + n / (a * c * d) + n / (b * c * d);
	res -= n / (a * b) + n / (a * c) + n / (a * d) + n / (b * c) + n / (b * d) + n / (c * d) + n / (a * b * c * d);
	minn = min(minn, a); minn = min(minn, b); minn = min(minn, c); minn = min(minn, d);
	cout << (res > 0 ? res: res - minn + 1);
	return 0;
}

#include <iostream>
using namespace std;
int main()
{
	int l, k, m, n, d, ans;
	cin >> l >> k >> m >> n >> d;
	int q;
	ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (i % l == 0 || i % k == 0 || i % m == 0 || i % n == 0)
			ans++;

	}
	cout << ans;

}

#include <iostream>
using namespace std;

int main()
{
    int a[4],n,s=0;
    for(int i=0;i<4;i++)
        cin>>a[i];
    cin>>n;

    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<4 && a[j]<=i;j++)
        {
            if(i%a[j]==0)
            {
                s++;
                break;
            }
        }
    }
    cout<<s<<endl;
    return 0;
}

#include <iostream>
using namespace std;
int main () {
    int k,l,m,n,d,cnt=0;
    cin >> k >> l >> m >> n >> d;
    for(int i=0; i<d; i++) {
        if(i%k==0 || i%l==0 ||i%m==0 ||i%n==0) {
            cnt++;
        }
    } cout << cnt << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll k,n,m,l,d,c=0;
    cin>>k>>l>>m>>n>>d;
    ll a[4];
    a[0] = k; a[1] = l; a[2] = m;
    a[3] = n;
    ll x = d,i=0;
    for(i=0;i<4&&x!=0;i++)
    {
        // cout<<c<<"\n";
        c+=x/a[i];
        x%=a[i];
    }
    cout<<c<<"\n";
    return 0;
}

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main() {
int dragon1,dragon2,dragon3,dragon4,dragons;
int sum;
cin>>dragon1>>dragon2>>dragon3>>dragon4>>dragons;
sum=dragon1+2*dragon2+dragon3+dragon4;
if (sum >12)
    cout<<sum<<endl;
else if(sum >dragons)
    cout<<"0"<<endl;
else
    cout<<dragons<<endl;

    return 0;
}

#include <iostream>
using namespace std;
void func(int mas[],int d,int x,int &kol)
{
	for (int i=1; i<=d; i=i+x)
	{if (mas[i]==0)
	{kol++;
	}
	mas[i]=i;
	}
	return;

}
int main()
{int k,l,m,n,d1;
int kol=0,kol1=0;
int const d=100001;
cin>>k;
cin>>l;
cin>>m;
cin>>n;
cin>>d1;
int a[d];
for (int i=0; i<d1; i++)
a[i]=0;
func(a,d1,k,kol);
kol1=kol1+kol;
kol=0;
func(a,d1,l,kol);
kol1=kol1+kol;
kol=0;
func(a,d1,m,kol);
kol1=kol1+kol;
kol=0;
func(a,d1,n,kol);
kol1=kol1+kol;
kol=0;

//for (int i=1;i<=d1;i++)
//{
//if (!a[i]==0)
//kol++;}

cout<<kol1;
return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int k,l,m,n,d;
    int sum=0;
    cin >> k >> l >> m >> n >> d;
    for(int i=0; i<d; i++)
        if((i%k==0&&i/k!=0)||(i%l==0&&i/l!=0)||(i%m==0&&i/m!=0)||(i%n==0&&i/n!=0))
            sum++;
    cout << sum;
    return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int arr[4];
    int k,l,m,n,d;
    for (int i=0;i<4;i++)
        cin>>arr[i];
    cin>>d;
    sort(arr,arr+4);

    k=arr[0];
    l=arr[1];
    m=arr[2];
    n=arr[3];

    int Damaged=0;
    int  lcounter=0;
    int  mcounter=0;
    int kcounter=0;
    int ncounter=0;
    if (d>0)
        for (int i=1;i<=d; i++){

            if (i%k==0  && k>0)
                kcounter++;
            else if (i%l==0 && l>0)
                lcounter++;
            else if (i%m==0 && m>0)
                mcounter++;
            else if (i%n==0  && ncounter<=10 && n>0)
                ncounter++;

        }

    Damaged+=kcounter+ncounter+mcounter+lcounter;
    cout<<Damaged<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	long dem1=0,x;
	x = min(a,b);
	x = min(a,c);
	x = min(a,d);
	for(x; x<=e; x++)
	{
		if( x%a!=0 &&x%b!=0&&x%c!=0&&x%c!=0)
		{
			dem1 = dem1 + 1;
		}
	}
	cout<<e - dem1 ;
	return 0;
}

#include <iostream>
using namespace std;
int main()
{ int k,l,m,n,d,sum=0,i;
 	cin >> k >> l >> m >> n >>d;
 int a [d];
 for(i=0;i<d;i++)
 {
 	a[i]=1;
 }

 for(i=k;i<d;i=k+i)
 {  sum=sum+a[i];
 	a[i]=0;

 }

 for(i=l;i<d;i=l+i)
 {  sum=sum+a[i];
 	a[i]=0;

}

  for(i=m;i<d;i=m+i)
 {  sum=sum+a[i];
 	a[i]=0;
 }
  for(i=n;i<d;i=n+i)
 {  sum=sum+a[i];
 	a[i]=0;
 }

 cout << sum+1;
}

#include<bits/stdc++.h>

using namespace std;

bool is_prime(int n) {
    for (int i = 2; i <= sqrt(n + 0.0); i++)
        if (!(n%i)){
            return false;
        }
    return true;
}

int main(){

	int k=0,l=0,m=0,n=0,d=0,cont=0;

	cin >> k >> l >> m >> n >> d;

	if (!(k & 1))
	{
		cont++;
		for (int i = 2; i < d; i++)
		{

			if (i==k or i==l or i==m or i==n)
			{

			}

			else if(is_prime(i)){
			cont++;

			}
		}
		cout<<d - cont;
	}

	else{
		cout<<d;
	}

	return 0;
}
// 1535859270969

#include <bits/stdc++.h>
using namespace std;

#define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
#define ar array
#define endl "\n"
int main() {
	crap;
	int k, l, m, n, d;
	cin >> k >> l >> m >> n >> d;
	bool dr[d];
	for(int i = k; i <= d; i += k) {
		dr[i - 1] = true;
	}
	for(int i = l; i <= d; i += l) {
		dr[i - 1] = true;
	}
	for(int i = m; i <= d; i += m) {
		dr[i - 1] = true;
	}
	for(int i = n; i <= d; i += n) {
		dr[i - 1] = true;
	}
	int cc = 0;
	for(int i = 0; i <= d; i++) {
		if(dr[i] == true) {
			cc++;
		}
	}
	cout << d - (d - cc);
	return 0;
}

#include<stdio.h>

int main(){
	int k, l, m, n, d;
	scanf("%d %d %d %d %d", &k, &l, &m, &n, &d);

	int suffered[100000];
	int i;
	for(i = 0; i < d; i++){
		if(i % k == 0) suffered[i]++;
		if(i % l == 0) suffered[i]++;
		if(i % m == 0) suffered[i]++;
		if(i % n == 0) suffered[i]++;
	}

	int res = 0;
	for(i = 0; i < d; i++)
		if(suffered[i] > 0) res++;

	printf("%d\n", res);

	return 0;
}

#include <iostream>
using namespace std;
main()
{ int n,l,m,k,d;
  cin>>n>>l>>m>>k>>d;
  int a[d];
 if(n>d && l>d && m>d && k>d)
 { cout<<0; return 0;}
  for(int i=0;i<d;i++)
   { if(i%n==0)
       a[i]=1;
     else if(i%l==0)
        a[i]=1;
     else if(i%m==0)
        a[i]==1;
     else if(i%k==0)
        a[i]=1;
     else
        a[i]=0;
   }
  k=0;
  for(int i=0;i<d;i++)
    if(a[i]==1)
      k++;
  cout<<k;
}

#include<bits/stdc++.h>
#include<iostream>
#include<string.h>

using namespace std;

int main()
{
    int k,l,m,n,d;
    cin>>k>>l>>m>>n>>d;
    int c=0;
    for(int i=0;i<d;i++)
    {
        double x=(double)(i%k);
        double y=(double)(i%l);
        double z=(double)(i%m);
        double a=(double)(i%n);
        if((x==0)||(y==0)||(z==0)||(a==0))
        {

        }
        else
        {
            c++;
        }
    }
    cout<<d-c;
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
int k,l,m,n,d;
cin>>k>>l>>m>>n>>d;
cout<<2*l+k+m+n;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
        string a, b, c;
        int cont=0;
        cin >> a;
        cin >> b;
        cin >> c;
        for(int i=0; i<c.size(); i++)
                for(int j=0; j<c.size(); j++){
                        if(a.size()>j)
                                if(c[i] == a[j]){
                                        a[j]= ' ';
                                        cont++;
                                        break;}
                        if(b.size()>j)
                                if(c[i] == b[j]){
                                        b[j]=' ';
                                        cont++;
                                        break;}
                }
        if(b.size()+a.size()!=c.size())
                cout << "NO" << endl;
        else if(cont==c.size())
                cout << "YES" << endl;
        else
                cout << "NO" << endl;
        return 0;
}

// 1535845716970

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll k, l, m, n, d;
    cin >> k >> l >> m >> n >> d;
    ll count = 0;
    for (ll i = 1; i <= n; i++){
        if (i % k == 0) count++;
        else if (i % l == 0) count++;
        else if (i % m == 0) count++;
        else if (i % n == 0) count++;
        else if (i % d == 0) count++;
    }
    cout << count;
}