#include <stdio.h>
#include <string.h>

int main()
{
	int k,l,m,n,d,count=0,temp;
	scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
	for(temp=1;temp<=d;++temp)
	{
		if(temp%k==0 || temp%l==0 || temp%m==0 || temp%n==0)
		{
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

#include<stdio.h>
int main()
{
    long long int i,a,b,c,d,e,count=0;
    scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e);
    for(i=1;i<=e;i++){
        if(i%a==0 || i%b==0 || i%c==0 || i%d==0)
            count++;
    }
        printf("%lld",count);
    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(i%k==0||i%l==0||i%m==0||i%n==0)
                count++;
        }
        printf("%d\n",count);
        count=0;
    }

}

#include<stdio.h>
int main()
{
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);}

/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>

int main()
{
 int k,l,m,n,d;
 int count = 0;
 scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
for(int i=1 ; i<=d;i++)
{
    if(i%k && i%l && i%m && i%n)
    count++;
}
  printf("%d",d-count);

}

#include <stdio.h>
#include <stdlib.h>

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

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int k,l,m,n,d, nr=0, i;
    scanf ("%d%d%d%d%d",&k,&l,&m,&n,&d);
    for (i++;i<=d;i++)
    {
        if(i%k!=0 && i%l!=0 && i%m!=0 && i%n!=0)
        {
            nr++;
        }

    }
    printf("%d", d-nr);
    return 0;
}

#include<stdio.h>
#include <math.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	int k, l, m, n, d, i, y = 0;
	int a[11000] = { 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)
			y++;
	}
	printf("%d", y);
}

#include<stdio.h>
int main()
{
    int k,l,m,n,d,i,count1=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)
    count1++;
    printf("%d",count1);
    return 0;
}

#include<stdio.h>
int main()
{
    int k,l,m,n,d,i,count=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)
    count++;
    printf("%d",count);
    return 0;
}

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

/*
 * File:   main.c
 * Author: ASUS
 *
 * Created on 25 April 2020, 17:47
 */

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
    int k,l,m,n,d;
    int count=0;
    scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);

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

    return 0;
}

#include <stdio.h>
int main()
{
    int n,j,k,l,m,count=0,i;
    scanf("%d %d %d %d",&j,&k,&l,&m);
    scanf("%d",&n);

    for(i=1;i<=n;i++)
    {
        if(i%j==0||i%k==0||i%l==0||i%m==0) count++;
    }
    printf("%d",count);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int i, d, a[4];
    for(i=0;i<4;i++){
        scanf("%d",&a[i]);
    }
    scanf("%d",&d);
    int check[d], count=0;
    for(i=0;i<d;i++)
        check[i]=0;

    for(i=0;i<4;i++){
        for(int j=a[i]-1;j<d;j+=a[i]){
            if(check[j]==0){
                count++;
                check[j]=1;
            }
        }
    }
    printf("%d",count);
}

#include<stdio.h>

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

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

    if(k==1 || l==1 || m==1 || n==1)
    {
        printf("%d", d);
        return 0;
    }
//    printf("%d\n", d);
    for(i=2; i<=d; i++)
    {
        if(i%k==0 || i%l==0 || i%m==0 || i%n==0)
            continue;
        else
            cnt++;
//        printf("%d %d\n", i, cnt);
    }

    cnt = d - cnt -1 ; //-1 because the first dragon isn't get damaged. If the first dragon gets damaged it means all the first dragons are damaged
    printf("%d", cnt);
}

#include<stdio.h>

int main()
{
    int k,l,m,n,d,count=0,i;
    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)
            count++;
    }
    printf("%d\n",d-count);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){

    int k,l,m,n,d;
    scanf("%i\n%i\n%i\n%i\n%i",&k,&l,&m,&n,&d);
    int hurt[d+1];
    for(int i=0; i<=d; i++){
        hurt[i] = 0;
    }

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

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

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

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

    int licznik = 0;

    for(int i=0; i<=d; i++){
        //printf("%i",hurt[i]);
        if(hurt[i]) licznik++;
    }

    printf("\n%i",licznik);

    return 0;
}

#include<stdio.h>
int main()
{
    int k,l,m,n,d,i,count=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)
            count++;
    }
    printf("%d\n",count);

}

#include<stdio.h>
#include<string.h>
int main(){
    long long i,a,b,c,d,n,count;
    scanf("%I64d %I64d %I64d %I64d %I64d",&a,&b,&c,&d,&n);
    count=0;
    for(i=1;i<=n;i++){
        if(i%a==0||i%b==0||i%c==0||i%d==0){
        count++;
        }
    }
    printf("%I64d",count);
    return 0;
}

#include<stdio.h>
int main()
{
    int k,l,m,n,i;
    long int d,count=0;
    scanf("%ld%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))
            count++;
    }
    printf("%ld",count);
    return(0);
}

#include<stdio.h>
#include<stdlib.h>

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

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

#include <stdio.h>
#include <stdlib.h>

int main()
{
    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);

    return 0;
}

#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

unsigned short readline_hu();
unsigned long  readline_lu();
short          readline_hi();

int  compare(const void * a, const void * b);
void allocate_error(size_t error_line, short exit_status);

// Solving-relevant functions
short  remove_multiples(short * dragon_types, unsigned short * dragon_types_length, unsigned long amount_dragons);
unsigned long subtract_multiple_torture(short * dragon_types, unsigned short dragon_types_length, unsigned long total_tortured, unsigned long amount_dragons);

unsigned long lcm(short a, short b);
unsigned long gcd(short a, short b);

int main() {

    unsigned short dragon_types_length;
    unsigned long  amount_dragons;
    unsigned long         solution;
    short *        dragon_types;
    short          status_code;
    //unsigned long  tmp;

    dragon_types_length = 4;

    dragon_types = malloc(sizeof(short) * dragon_types_length);

    // ----- ERROR -----
    if (dragon_types == NULL)
        allocate_error(__LINE__, -1);
    // ----- ERROR -----

    // Get all damages dragons
    for (unsigned short index = 0; index < dragon_types_length; index++)
        dragon_types [index] = readline_hi();

    //-----===== Solve =====-----

    // Get amount of dragons
    amount_dragons = readline_lu();

    status_code = remove_multiples(dragon_types, &dragon_types_length, amount_dragons);

    solution = 0;

    if (status_code) {
        // Compute the total amount of tortured dragons
        for (unsigned short index = 0; index < dragon_types_length; index++)
            solution += (unsigned long) amount_dragons / dragon_types [index];

        // Subtract all dragons who got tortured twice or even more
        //printf("Before subtraction: %lf\n", solution);
        solution = subtract_multiple_torture(dragon_types, dragon_types_length, solution, amount_dragons);
    }

    //printf("%lf\n", solution);
    //tmp = (unsigned long) round(solution);

    //if (tmp == 35247 || tmp == 36321)
    //    tmp--;
    printf("%lu\n", solution);
    //printf("%lu\n", tmp);
    free(dragon_types);

    return EXIT_SUCCESS;
}

short remove_multiples(short * dragon_types, unsigned short * dragon_types_length, unsigned long amount_dragons) {
    /*
     * Remove all multiples of the dragon_types because it doesn't matter (in
     * this case) if a dragon got punished twice or even more.
     *
     * To achieve that we need to iterate two times through the whole list in
     * order to find all multiples.
     *
     * ------
     * Return value: The array "dragon_types" but all multiples are removed
     */

    short *        tmp_dragon_types;
    unsigned short amount_multiples;
    amount_multiples = 0;

    // Sort the array to make it easier to remove the multiples
    qsort(dragon_types, *dragon_types_length, sizeof(short), compare);

    /*
     * Remove all values first which are larger than the amount of dragons.
     */
    for (unsigned short index = 0; index < *dragon_types_length; index++) {
        if ((unsigned long) dragon_types [index] > amount_dragons) {
            amount_multiples++;
            dragon_types [index] = -1;
        }
    }

    /*
     * Now remove all multiples of the array. (if there are any)
     */
    for (unsigned short index1 = 0; index1 < *dragon_types_length; index1++) {

        // This for-loop is to compare the number with the number at index1
        for (unsigned short index2 = index1 + 1; index2 < *dragon_types_length; index2++) {

            /*
             * We found a multiple or a value which is greater than the amount of dragons. Now we remove the multiple and remove the
             * multiple with -1. After that we resize the array and remove the
             * -1 numbers.
             */
            if (dragon_types [index2] % dragon_types [index1] == 0 && dragon_types [index2] != -1 && dragon_types [index1] != -1) {
                // Replace the multiple with -1
                dragon_types [index2] = -1;
                amount_multiples++;
            }
        }
    }

    /*
     *  Special case : All values are greater than the amount of dragons
     *  => Return 0 to make it clear that the amount of dragons is zero
     */
    if (*dragon_types_length == amount_multiples) {
        return 0;
    }

    // Resize the array if there are multiples in the array and remove them
    else if (amount_multiples > 0) {

        unsigned short tmp_index;

        tmp_dragon_types = realloc(dragon_types, sizeof(short) * (*dragon_types_length - amount_multiples));

        // ----- ERROR -----
        if (tmp_dragon_types == NULL)
            allocate_error(__LINE__, -2);
        // ----- ERROR -----

        // Remove all -1 numbers
        tmp_index = 0;

        for (unsigned short index = 0; index < *dragon_types_length; index++) {

            // Add all numbers which aren't -1 from the original list to the
            // temporary list
            if (dragon_types [index] != -1)
                tmp_dragon_types [tmp_index++] = dragon_types [index];
        }

        // Refresh the values
        dragon_types = tmp_dragon_types;
        *dragon_types_length -= amount_multiples;
    }

    return 1;
}

unsigned long subtract_multiple_torture(short * dragon_types, unsigned short dragon_types_length, unsigned long total_tortured, unsigned long amount_dragons) {
    /*
     * This funcion will calculate the LCM values of dragon_types and subtract
     * them to total_tortured to get the amount of dragons who got tortured at
     * least one time.
     */

    // This is needed when the dragons have been tortured more than twice.
    unsigned long long subtraction;

    // Subtract the solution with the LCM
    for (unsigned short index1 = 0; index1 < dragon_types_length; index1++) {

        for (unsigned short index2 = index1 + 1; index2 < dragon_types_length;
             index2++) {

            total_tortured -= (unsigned long) amount_dragons / lcm(dragon_types [index1], dragon_types [index2]);
        }
    }

    /*
     * Some dragons are tortured more than twice. With the subtraction above we
     * just removed "one torture". So we need to exclude the other tortures as
     * well.
     */

    if (dragon_types_length >= 3) {

        subtraction = lcm(lcm(dragon_types [0], dragon_types [1]), dragon_types [2]);

        if (subtraction <= amount_dragons)
            total_tortured += (unsigned long) amount_dragons / subtraction;

        // Are there even dragons who got tortured four times????
        if (dragon_types_length == 4) {

            total_tortured += amount_dragons / lcm(lcm(dragon_types [0], dragon_types [2]), dragon_types [3]);
            total_tortured += amount_dragons / lcm(lcm(dragon_types [0], dragon_types [1]), dragon_types [3]);
            total_tortured += amount_dragons / lcm(lcm(dragon_types [1], dragon_types [2]), dragon_types [3]);

            //if (subtraction <= amount_dragons) {
            //    total_tortured += (unsigned long) amount_dragons / subtraction;
            //}

            // Remove the dragons who got tortured four times
            subtraction = 1;
            for (unsigned short index = 0; index < dragon_types_length; index++)
                subtraction = lcm(subtraction, dragon_types [index]);

            if (subtraction <= amount_dragons)
                total_tortured -= (unsigned long) amount_dragons / subtraction;
            //printf("%lf\n", total_tortured);
        }
    }

    return total_tortured;
}

unsigned long lcm(short a, short b) {
    return a * b / (unsigned long) gcd(a, b);
}

unsigned long gcd(short a, short b) {
    short c;

    do {
        c = a % b;
        a = b;
        b = c;
    } while (b != 0);

    return (unsigned long) a;
}

// -----=====##### Nice functions #####=====-----
void allocate_error(size_t error_line, short exit_status) {
    printf("-----===== ERROR IN LINE %lu =====-----\n", error_line);
    printf("Couldn't allocate memory!\n");
    printf("Exit code: %hi\n", exit_status);
    perror("");
    exit(exit_status);
}

unsigned short readline_hu() {

    char           buffer [6];
    unsigned short buffer_index = 0;
    int            character;

    // Get the digits of the number
    while ((character = getchar()) != '\n' && character != EOF && character != ' ' && buffer_index < 5)
        buffer [buffer_index++] = (char) character;

    // Set the end of the line
    buffer [buffer_index] = '\0';

    // Convert string into unsigned short
    return (unsigned short) strtoul(buffer, NULL, 10);
}

short readline_hi() {

    char           buffer [6];
    unsigned short buffer_index = 0;
    int            character;

    // Get the digits of the number
    while ((character = getchar()) != '\n' && character != EOF && character != ' ' && buffer_index < 5)
        buffer [buffer_index++] = (char) character;

    // Set the end of the line
    buffer [buffer_index] = '\0';

    // Convert string into unsigned short
    return (short) strtol(buffer, NULL, 10);
}

unsigned long readline_lu() {

    char           buffer [12];
    unsigned short buffer_index = 0;
    int            character;

    // Get the digits of the number
    while ((character = getchar()) != '\n' && character != EOF && character != ' ' && buffer_index < 11)
        buffer [buffer_index++] = (char) character;

    // Set the end of the line
    buffer [buffer_index] = '\0';

    return strtoul(buffer, NULL, 10);
}

int compare(const void * a, const void * b) {

    if (*(unsigned short *) a < *(unsigned short *) b)
        return -1;

    else if (*(unsigned short *) a == *(unsigned short *) b)
        return 0;

    else
        return 1;}

#include<stdio.h>
/*void sort(int ar[])
{
for(int i=0;i<4;i++)
{
for(int j=0;j<3;j++)
{
if(ar[j]>ar[j+1])
{
int temp=ar[j+1];
ar[j+1]=ar[j];
ar[j]=temp;
}

}
}

}*/
int main()
{
    int k, l, m, n,d,count=0;
    scanf("%d\n%d\n%d\n%d\n%d",&k,&l,&m,&n,&d);
    int arr[d];
    for(int i=0;i<d;i++)
    arr[i]=i+1;
    for(int j=0;j<d;j++)
    {
    if(arr[j]%k==0 ||arr[j]%l==0 ||arr[j]%m==0 ||arr[j]%n==0)
    count++;
    }
    printf("%d",count);
    return 0;
}

#include<stdio.h>
main()
{
    int k,l,m,n,d,i,j,s,c=0,a[4];
    scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
//    a[0]=k;a[1]=l;a[2]=m;a[3]=n;
    for(i=1;i<=d;i++)
    {
        if((i%k)==0)
        {
            c++;
            continue;
        }
        else if((i%l)==0)
        {
            c++;
            continue;
        }
        else if((i%m)==0)
        {
            c++;
            continue;
        }
        else if((i%n)==0)
        {
            c++;
            continue;
        }
        else continue;
    }

    printf("%d",c);
}

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

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

#include<stdio.h>
int main()
{
	int k, l, m, n, d, i;
	int count = 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)
			count++;
	}
	printf("%d\n",count);
	return 0;
}

#include<stdio.h>
#include<stdlib.h>

int main()
{

	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
     #endif
    int i,c=0;int k,l,m,n,d;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)
 c++;
}
printf("%d",c);
return 0;
}

#include<stdio.h>
int main(){
    int k,l,m,n,d,x,count=0;
    scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);

    for(x=1;x<=d;x++){

        if(x%k==0 || x%l==0 || x%n==0 || x%m==0) count++;

    }
    printf("%d",count);
    return 0;

}

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

    }

   printf("%d",dragon);
   return 0;

}

#include <stdio.h>
#define in freopen("in", "r+", stdin)
#define ou freopen("ou", "w+", stdout)
int main()
{
//    in;
//    ou;
    int a[100000]={0}, k, l, m, n, d;
    scanf("%d %d %d %d %d", &k, &l, &m, &n, &d);
    int i;

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

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

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

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

    int count=0;
    for(i=0;i<d;i++)
        if(a[i]==1)
            count++;
    printf("%d\n", count);
    return 0;
}

#include <stdio.h>
#define in freopen("in", "r+", stdin)
#define ou freopen("ou", "w+", stdout)
int gcd(int a, int b)
{
    int t;
    while(a)
    {
        t=a;
        a=b%a;
        b=t;
    }
    return b;
}
int lcm(int a, int b)
{
    return (a*b)/gcd(a, b);
}
int eval(
    int k,
    int l,
    int m,
    int n,
    int d)
{
    return d/k+d/l+d/m+d/n-d/lcm(k, l)-d/lcm(k, m)-d/lcm(k, n)-d/lcm(l, m)-d/lcm(l, n)-d/lcm(m, n)+d/lcm(lcm(k, l), m)+d/lcm(lcm(k, l), n)+d/lcm(lcm(k, m), n)+d/lcm(lcm(l, m), n)-d/lcm(lcm(k, l), lcm(m, n));
}
int main()
{
   // in;
    int k, l, m, n, d;
    scanf("%d %d %d %d %d", &k, &l, &m, &n, &d);
    printf("%d\n", eval(k, l, m, n, d));
}

#include <stdio.h>
int an[100001];

int main()
{
	int i, k, l, m, n, d;
	int ans = 0;
	scanf("%d", &k);
	scanf("%d", &l);
	scanf("%d", &m);
	scanf("%d", &n);
	scanf("%d", &d);
	for (i = 0; i <= d; i++) an[i] = 0;
	for (i = k; i <= d; i += k) an[i] = 1;
	for (i = l; i <= d; i += l) an[i] = 1;
	for (i = m; i <= d; i += m) an[i] = 1;
	for (i = n; i <= d; i += n) an[i] = 1;
	for (i = 1; i <= d; i++) if (an[i]) ans++;
	printf("%d\n", ans);

	return 0;
}

#include <stdio.h>

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

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

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int k,l,m,n,d,i,brojac=0;
    int niz[100500]={0};
    scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
    if (k==1 || l==1 || m==1 || n==1)
    {
        printf("%d",d);
        return 0;
    }
    for (i=k; i<=d; i=i+k)
            niz[i]=1;
    for (i=l; i<=d; i=i+l)
            niz[i]=1;
    for (i=m; i<=d; i=i+m)
            niz[i]=1;
    for (i=n; i<=d; i=i+n)
            niz[i]=1;
    for (i=0; i<=d; i++)
        if (niz[i]!=0)
            brojac++;
    printf("%d",brojac);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main(void){

    int k,l,m,n,d,missed=0,i,temp;

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

    if(l < k && l < m && l < n){
        temp = k;
        k = l;
        l = temp;
    }
    else if(m < k && m < l && m < n){
        temp = k;
        k = m;
        m = temp;
    }
    else if(n < k && n < l && n < m){
        temp = k;
        k = n;
        n = temp;
    }

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

    printf("%d\n",d-missed);
    return 0;
}

#include <stdio.h>
int main()
{int n, k, l, m, d;int ans = 0; scanf("%d %d %d %d %d", &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)ans++;}printf("%d",ans);
}

#include<stdio.h>
#include<string.h>

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

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

    for(i=1; i<=d; i++)
    {
        if(i%k==0)
            count++;
        else if(i%l==0)
            count++;
        else if(i%m==0)
            count++;
        else if(i%n==0)
            count++;
    }
    printf("%d\n",count);

    return 0;
}

#include<stdio.h>

int main()
{
    int k,l,m,n,d,i,count=0;
    scanf("%d\n%d\n%d\n%d\n%d",&k,&l,&m,&n,&d);
    int flag[d+1];
    for(i=1;i<=d;++i)
        flag[i]=0;
    for(i=1;k*i<=d;++i)
        flag[k*i]=1;
    for(i=1;l*i<=d;++i)
        flag[l*i]=1;
    for(i=1;m*i<=d;++i)
        flag[m*i]=1;
    for(i=1;n*i<=d;++i)
        flag[n*i]=1;
    for(i=1;i<=d;++i)
    {
        if(flag[i]==1)
            count++;
    }
    printf("%d",count);
    return 0;
}

#include <stdio.h>
#include <math.h>
int main()
{
    int k,l,m,n,d,x;
    scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);
    x=floor(d/k)+floor(d/l)+floor(d/m)+floor(d/n)-floor(d/(k*l))-floor(d/(m*l))-floor(d/(m*n))-floor(d/(k*m))-floor(d/(k*n))-floor(d/(n*l));
    if (k==1 || l==1 || m==1 || n==1)
    {
        printf("%d",d);
    }
    else
    printf("%d",x);
    return 0;

}

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <math.h>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RS(X) scanf("%s", (X))
#define LEN(X) strlen(X)

int main(){
    int n,div[4],ndiv=4,res=0,pen=0;
    scanf("%d %d %d %d %d",&div[0],&div[1],&div[2],&div[3],&n);
    REP(i,ndiv){
        REP(j,ndiv){
            if(div[i]%div[j]==0 && i!=j){
                for(int x=i;x<ndiv;x++){
                    div[x]=div[x+1];
                }
                ndiv--;
            }

        }
    }

    REP(x,ndiv){
        res+=n/div[x];
        for(int i=x+1;i<ndiv;i++)pen+=n/(div[x]*div[i]);
    }
    printf("%d\n",res-pen);
    return 0;
}

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

	return 0;

}

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int k = 0, l = 0, m = 0, n = 0, d = 0, abused = 0;
    scanf("%d %d %d %d %d", &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)
        {
            abused++;
        }
    }
    printf("%d\n", abused);
    return 0;
}

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

	else if (q%l==0){
		i++;
		continue;}

	else if(q%m==0){
		i++;
		continue;}

	else if(q%n==0){
		i++;
		continue;}
	}
printf("%d",i);

	return 0;}

#include<stdio.h>

int main()
{
    int k,l,m,n,d,count=1;
    scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
    int arr[d];
    for(int i=0;i<d;i++)
    arr[i]=i+1;
    for(int i=k;i<=d;i+=k)
    arr[i]=0;
    for(int i=l;i<=d;i+=l)
    arr[i]=0;
    for(int i=m;i<=d;i+=m)
    arr[i]=0;
    for(int i=n;i<=d;i+=n)
    arr[i]=0;
    for(int i=0;i<d;i++)
    {
    if(arr[i]==0)
    count++;
    }
    printf("%d",count);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int gcd(int a, int b)
{
	int temp;
	while (b != 0)
	{
		temp = a % b;

		a = b;
		b = temp;
	}
	return a;
}

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

	int lcm_k_l = k * l / gcd(k, l);
	int lcm_k_l_m = m * lcm_k_l / gcd(m, lcm_k_l);
	int common_lcm = n * lcm_k_l_m / gcd(n, lcm_k_l_m);

	char *array = calloc(common_lcm, sizeof(*array));

	for (int i = 0; i < common_lcm; i += k) {
		array[i] = 1;
	}

	for (int i = 0; i < common_lcm; i += l) {
		array[i] = 1;
	}

	for (int i = 0; i < common_lcm; i += m) {
		array[i] = 1;
	}

	for (int i = 0; i < common_lcm; i += n) {
		array[i] = 1;
	}

	int count = 0;

	for (int i = 0; i < common_lcm; i++) {
		if (array[i])
			count++;
	}

	free(array);

	int max_count = d / common_lcm;
	//printf("count : %d, max_count : %d\n", count, max_count);
	count *= max_count;

	int lost = d - max_count * common_lcm;

	char *lost_array = calloc(lost, sizeof(*lost_array));
	for (int i = 0; i < lost; i += k) {
		lost_array[i] = 1;
	}

	for (int i = 0; i < lost; i += l) {
		lost_array[i] = 1;
	}

	for (int i = 0; i < lost; i += m) {
		lost_array[i] = 1;
	}

	for (int i = 0; i < lost; i += n) {
		lost_array[i] = 1;
	}

	for (int i = 0; i < lost; i++) {
		if (lost_array[i])
			count++;
	}

	free(lost_array);

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

	return 0;
}

#include <stdio.h>
#include <stdlib.h>

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

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

    return 0;
}

#include<stdio.h>
int main()
{
    int k,l,m,n,d,i,j,x,y,z,res,a,b;

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

    if(k==1)
    {
        res=d;
    }
    else
    {
        x=d/k;
        i= d-x;
        y=i/l;
        j=d-(x+y);
        z=j/m;
        b=d-(x+y+z);
        a=b/n;
        res=x+y+z-a;
    }
    printf("%d\n",res);
    return 0;
}

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

/*
http://codeforces.com/problemset/problem/148/A
*/
#include<stdio.h>
int main()
{
    int k,l,m,n,d,i;//d-total number of dragon.
    scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);
    double dragon[d];
    if( k==1 || l==1 || m==1 || k==n ){
        printf("%d",d);
        return 0;
    }
    for(i=k-1;i<d;i+=k){
        dragon[i]=2.5;
    }
    //int t;
    /*for(i=k-1;i<d;i+=k){
        printf("%d    %d\n",dragon[i],i);
        //t++;
    }*/
    //printf("\n%d",t);
    //for(i=0;i<d;i++)printf("%d\t",dragon[i]);
    for(i=l-1;i<d;i+=l){
        dragon[i]=2.5;
    }
    for(i=m-1;i<d;i+=m){
        dragon[i]=2.5;
    }
    for(i=n-1;i<d;i+=n){
        dragon[i]=2.5;
    }

    int t=0;
    for(i=0;i<d;i++){
        if(dragon[i] != 2.5)t++;
    }

    printf("%d",d-t);

}

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

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

}
printf("%d",i);

return 0;}

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

       }
   }
    //printf("%d ",c);
  if(flag==0) printf("%I64d",d-c);
  else if(flag==1) printf("0");
    return 0;
}

#include <stdio.h>
#include <math.h>
#define PI 2*acos(0.0)
int main()
{
    int a,b;
    double c,d,e,f,g,h,r;
    scanf("%d", &b);
    for(a=1; a<=b; a++)
    {
        scanf("%lf", &r);
        c=((r+r)*(r+r))-(PI*r*r);
        printf("Case %d: %.2lf\n",a,c);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main(void){

    int k,l,m,n,d,missed=0,i,temp;

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

    if(l < k && l < m && l < n){
        temp = k;
        k = l;
        l = temp;
    }
    else if(m < k && m < l && m < n){
        temp = k;
        k = m;
        m = temp;
    }
    else if(n < k && n < l && n < m){
        temp = k;
        k = n;
        n = temp;
    }

    if(k>=d){
        printf("0\n");
        exit(0);
    }

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

    printf("%d\n",d-missed);
    return 0;
}

#include<stdio.h>
int main()
{ int k,l,m,n,d,i,count;i=1;count=0;scanf("%d,%d,%d,%d,%d",&k,&l,&m,&n,&d);
	while(i<=d)

{ if(i%k==0||i%l==0||i%m==0||i%n==0){ count++;} i++;}
	printf("%d",count);

	return 0;

}

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	int k, l, m, n, d, i, a=0;
	scanf("%d%d%d%d%d", &k, &l, &m, &n, &d);
	for(i=0;i<d;i++){
		if (i%k==0 || i%l==0 || i%m==0 || i%n==0) a++;
	}
	printf("%d",a);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <math.h>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RS(X) scanf("%s", (X))
#define LEN(X) strlen(X)

int main(){
    int n,res=0,k,l,m,d;
    scanf("%d %d %d %d %d",&k,&l,&m,&d,&n);
    res = n;
    if(k == 1 || l == 1 || m == 1 || n == 1)
    {
        printf("%d\n",n);
        return 0;
    }
    else
    {
        for(int i = 1; i <= n; i++)
        {
            if((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%d != 0))
                res--;
        }
       printf("%d\n",res);
    }
    return 0;
}

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

#include<stdio.h>
#include<string.h>
int main()
{
    int n,k,l,m,d,i,s=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||i%l==0||i%m==0||i%n==0)
        {
            s++;
        }
    }
    printf("%d",s);
    return 0;
}

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

int gcd (int x, int y){
	int r;
	while(1){
		r=x%y;
		if (r==0)
			break;
		x=y;
		y=r;
	}
	return y;
}

#include<stdio.h>
int main()
{
    int k,l,m,n,count=0;
    long long int d;
    scanf("%d %d %d %d %I64d",&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++;
        }
    }
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>

int main(void)
{
	int k, l, m, n, d, i, arr[100001], count=0;
	scanf("%d%d%d%d%d", &k, &l, &m, &n, &d);
	for (i = k-1; i < d; i+=k)

	{
		arr[i] = 1;
	}
	for (i = l-1; i <= d; i += l)
	{
		arr[i] = 1;
	}
	for (i = m-1; i <= d; i += m)
	{
		arr[i] = 1;
	}
	for (i = n-1; i <= d; i += n)
	{
		arr[i] = 1;
	}
	for (i = 0; i < d; i++)
	{
		if (arr[i] == 1) count++;
	}
	printf("%d", count);
}

#include<stdio.h>
int main()
{
    int k,l,m,n,d,a,b,c;
    scanf("%d",&k);
    scanf("%d",&l);
    scanf("%d",&m);
    scanf("%d",&n);
    scanf("%d",&d);
    a= d/n;
    b=d%n;
    a=a*4;
    if(b>=k && b<l)
    {
     a=a+1;
    }

    else if (b>=l && b<m)
    {
     a=a+2;
    }

    else if (b>=m && n<l)
    {
     a=a+3;
    }
    printf("%d\n",a);
    return 0;
}

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

#include <stdio.h>
#include <string.h>

int main()
{
    char A[101],B[101];
	int i,n;
	scanf(" %s %s",A,B);
	n=strlen(A);
	for(i=0;i<n;++i)
	{
		if( A[i] == B[i] )
			printf("0");
		else
			printf("1");
	}
	printf("\n");
	return 0;
}

#include <stdio.h>
#include <string.h>

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

#include <stdio.h>
int main ()
{
    int k,l,m,n,d,re,p,q,r,s,t,u,v,w,x,y;
    scanf("%d %d %d %d %d",&k, &l, &m, &n, &d);
    if (k==1)
    {
       re=d;
    }
    else
    {
        p=d/k;
        q=d/l;
        r=d/m;
        s=d/n;
        t=d/(k*l);
        u=d/(k*m);
        v=d/(k*n);
        w=d/(l*n);
        x=d/(l*m);
        y=d/(m*n);
        re=p+q+r+s-t-u-v-w-x-y;
    }
    printf("%d\n",re);
    return 0;
}

#include<stdio.h>
int main()
{
    int k,l,m,n,d,i,j,x,y,z,res;

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

    if(k==1)
    {
        res=d;
    }
    else
    {
        x=d/k;
        i= d-x;
        y=i/l;
        j=d-(x+y);
        z=j/m;
        res=x+y+z-1;
    }
    printf("%d\n",res);
    return 0;
}

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

char * read_line();
void allocate_error();
short * remove_multiples(short * numbers, unsigned short * length);
unsigned short substract_mutiple_tortured_dragons(short * numbers, unsigned short * length, unsigned long dragons);

int main() {

	char * buffer = read_line();
	char * rest;

	short * numbers;
	unsigned short numbers_size = 4;
	unsigned long dragons;
	unsigned long solution = 0;

	numbers = malloc(sizeof(unsigned short) * numbers_size);
	if (numbers == NULL)
		allocate_error();

	// Saves the numbers
	for (unsigned short index=0; index<4; index++) {

		numbers[index] = (short) strtol(buffer, &rest, 10);
		free(buffer);
		buffer = read_line();
	}
	dragons = strtol(buffer, &rest, 10);
	free(buffer);

	// ----- SOLVE -----
	// Now we have to substract all dragons that got punised more than once
	// remove all multiples
	numbers = remove_multiples(numbers, &numbers_size);

	for (unsigned short index=0; index<numbers_size; index++) {
	}

    // Add all tortured dragons...
    for (unsigned short index=0; index<numbers_size; index++) {
        solution += (unsigned long) dragons / numbers[index];
    }

    if (numbers_size > 1) {
        // Now we need to substract all mutiple counted numbers
        solution -= substract_mutiple_tortured_dragons(numbers, &numbers_size, dragons);
    }

    printf("%lu\n", solution);
	return EXIT_SUCCESS;
}

char * read_line() {

	unsigned short buffersize = 10;
	unsigned short line_index = 0;

	char * line = malloc(buffersize);
	char * tmp;

	// ERROR
	if (line == NULL)
		allocate_error();
	// ERROR

	int character;

	while ((character = getchar()) != '\n' && character != EOF && buffersize < 65535) {

		// BUFFER IS TOO SMALL
		if (buffersize <= line_index + 1) {
			buffersize += 10;
			tmp = realloc(line, buffersize);

			// ERROR
			if (tmp == NULL)
				allocate_error();
			// ERROR

			line = tmp;
		}
		// BUFFER IS TOO SMALL

		line[line_index++] = (char) character;
	}

	// Set the end of the line
	line[line_index] = '\0';

	// Fit the allocated memory to the string lenght => No wasted memory
	tmp = realloc(line, strlen(line) + 1);

	// ERROR
	if (tmp == NULL)
		allocate_error();
	// ERROR

	line = tmp;
	return line;
}

void allocate_error() {
	perror("Couldn't allocate memory!");
	exit(1);
}

short * remove_multiples(short * numbers, unsigned short * length) {
    /*
     * This function will change the list `numbers` and will remove all mutiple numbers.
     */
    unsigned short amount_of_mutiples = 0;
    short * tmp;
    unsigned short tmp_index = 0;

    for (unsigned short index=0; index<*length; index++) {

        for(unsigned short control_index=0; control_index<*length; control_index++) {
            // Found a mutiple!!!
            // Except the same number
            if (numbers[control_index] % numbers[index] == 0 && control_index != index) {
                numbers[control_index] = -1;
                amount_of_mutiples++;
            }
        }

        // Now we must remove the mutiple numbers
        tmp = malloc(*length - amount_of_mutiples);

        // ERRROR
        if (tmp == NULL)
            allocate_error();
        // ERROR

        // now fill it with it's good numbers
        for (unsigned short get_single=0; get_single<*length; get_single++) {

            if (numbers[get_single] != -1)
                tmp[tmp_index++] = numbers[get_single];
        }
        free(numbers);

        // Now after removing the mutiples we can use it now
        numbers = tmp;
        *length -= amount_of_mutiples;
        amount_of_mutiples = 0;
        tmp_index = 0;
    }
    return numbers;
}

unsigned short substract_mutiple_tortured_dragons(short * numbers, unsigned short * length, unsigned long dragons) {
    /*
     * This function will substract the amount of dragons which got tortured more than once.
     */
    unsigned long amount_of_tortured_dragons_than_once = 0;

    /*
     * index1: This will focus on one number at the beginning.
     * index2: This will iterate through the other numbers.
     * All in one they should create every multiple which are possible to create with the numbers.
     */
    unsigned short index1;
    unsigned short index2;

    for(index1=0; index1<*length; index1++) {

        for (index2=index1 + 1; index2<*length; index2++) {

            if (numbers[index1])
            amount_of_tortured_dragons_than_once += (unsigned long) round(dragons / (numbers[index1] * numbers[index2]));
        }
    }
    return amount_of_tortured_dragons_than_once;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int k,l,m,n,d,i,brojac=0;
    int niz[10005]={0};
    scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
    if (k==1)
    {
        printf("%d",d);
        return 0;
    }
    for (i=0; i<d; i++)
        if (i % k==0)
            niz[i]=1;
    for (i=0; i<d; i++)
        if (i % l==0)
            niz[i]=1;
    for (i=0; i<d; i++)
        if (i % m==0)
            niz[i]=1;
    for (i=0; i<d; i++)
        if (i % n==0)
            niz[i]=1;
    for (i=0; i<d; i++)
        if (niz[i]==0)
            brojac++;
    printf("%d",d-brojac);
    return 0;
}

#include <stdio.h>
int main()
{
    int k, l, m, n, d;
    scanf("%d",&k);
    scanf("%d",&l);
    scanf("%d",&m);
    scanf("%d",&n);
    scanf("%d",&d);
    int a[d+1];
    for(int i = 0; i < d; i++)
    {
        a[i] = 0;
    }
    int counter = 0;
    for(int i = 0; i < d;i = i+k)
    {
        counter++;
        a[i]= 1 ;
    }
    for(int i = 0; i < d;i = i+l)
    {
        if(a[i] != 1)
        {
        counter++; a[i] = 1;
        }
    }
    for(int i = 0; i < d;i = i+m)
    {
        if(a[i] != 1){
           counter++; a[i] = 1;
        }

    }
    for(int i = 0; i < d;i = i+n)
    {
        if(a[i] != 1)
        counter++; a[i] = 1;
    }
    printf("%d",counter);
    return 0;
}

#include <stdio.h>
#define in freopen("in", "r+", stdin)
#define ou freopen("ou", "w+", stdin)
int main()
{
//    in;
//    ou;
    int a[100000], k, l, m, n, d;
    scanf("%d %d %d %d %d", &k, &l, &m, &n, &d);
    int i;
    for(i=0;i<d;i+=k)
        a[i-1]=1;
    for(i=0;i<d;i+=l)
        a[i-1]=1;
    for(i=0;i<d;i+=m)
        a[i-1]=1;
    for(i=0;i<d;i+=n)
        a[i-1]=1;
    int count=0;
    for(i=0;i<d;i++)
        if(a[i]==1)
            count++;
    printf("%d\n", count+1);
    return 0;
}

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

int gcd (int x, int y){
    int r;
    while(1){
        r=x%y;
        if (r==0)
            break;
        x=y;
        y=r;
    }
    return y;
}

#include <stdio.h>

int main()
{
    int k,l,m,n,d,sum;
    scanf("%d\n %d\n %d\n %d\n %d",&k,&l,&m,&n,&d);
    if(k==1)
        printf("%d",d);
    else
    {
        sum=d-n-k;
    printf("%d",sum);
    }
    return 0;
}

#include<stdio.h>
int main()
{
	int n,i,a[10005],len,max=0,cur;
	scanf("%d",&n);
	for (i=0;i<n;i++)
		scanf("%d",&a[i]);
	for (cur=a[0],i=1,len=1;i<n;i++,cur=a[i])
		if (a[i]>=cur)
		{
			if (++len>max)
				max=len;
		}
		else
			len=1;
	printf("%d\n",max);
	return 0;
}

#include <stdio.h>

int main() {
	int k,l,m,n,d;
	int dizi[100000];
	int secimler[4];
	for (int i = 0; i < 100000; i++) {
		dizi[i] = 0;
	}
	scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);
	secimler[0] = k;
	secimler[1] = l;
	secimler[2] = m;
	secimler[3] = n;
	int j = 0;
	for (int u = 0; u < 4; u++) {
		if (secimler[u] == secimler[u-1]) {
			u++;
		}
		else {
			for (int i = secimler[u]; i < d; i += secimler[u]) {
				int kontrol = 0;
				for (int t = 0; t < 100; t++)
					if (dizi[t] == i) {
						kontrol = 1;
						break;
				}
				if (kontrol != 1) {
					dizi[j++] = i;
					//printf("%d\n",dizi[j-1]);
				}
			}
		}
	}
	if (j == 0) printf("---%d",j);
	else printf("---%d",j+1);
}

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

    }
    else{
        printf("0");
    }
    return 0;
}

#include<stdio.h>
int count[1000001]={0};
int main()
{
	int k,l,m,n,d;

	int i,j;

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

	scanf("%d",&d);

	for(i=k;i<=d;i=i+k)
	{
		count[i]=1;
//		printf("The value of k is: %d\n",i);
	}
	for(i=l;i<d;i=i+l)
        {
                count[i]=1;
        }
	for(i=m;i<d;i=i+m)
        {
                count[i]=1;
        }
	for(i=n;i<d;i=i+n)
        {
                count[i]=1;
        }

	int ctr=0;

	for(i=1;i<1000001;i++)
	{
//		printf("%d\n",count[i]);
		if(count[i]==1)
		{
			ctr++;
		}
	}
	printf("%d\n",ctr);

	return 0;

}

#include <stdio.h>

int main() {
	int k,l,m,n,d;
	int dizi[100000];
	int secimler[4];
	for (int i = 0; i < 100000; i++) {
		dizi[i] = 0;
	}
	scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);
	secimler[0] = k;
	secimler[1] = l;
	secimler[2] = m;
	secimler[3] = n;
	int j = 0;
	for (int u = 0; u < 4; u++) {
		if (secimler[u] == secimler[u-1]) {
			u++;
			continue;
		}
		for (int i = secimler[u]; i < d; i += secimler[u]) {
			int kontrol = 0;
			for (int t = 0; t < 100; t++)
				if (dizi[t] == i) {
					kontrol = 1;
					break;
			}
			if (kontrol != 1) {
				dizi[j++] = i;
			}
		}
	}
	printf("%d",j+1);
}

#include<stdio.h>
#include<conio.h>

int main()
{
	int k,l,m,n,d,i,num,min,count,cnt2=0;
	scanf("%d\n%d\n%d\n%d\n%d",&k,&l,&m,&n,&d);
	int damaged[d],damaged2[d],damaged3[d],damaged4[d];
	damaged[1]=0;
	damaged2[1]=0;
	damaged3[1]=0;
	damaged4[1]=0;
	if(k==1||l==1||m==1||n==1)
	{
		printf("%d\n",d);
	}
	else
	{
	 if((k>l) && (k>m) && (k>n))
        min=k;
    	  else	if((l>k) && (l>m) && (l>n))
        	min=l;
        	else	if((m>l) && (m>l) && (m>n))
        		min=k;
        		else	if((n>l) && (n>m) && (n>k))
       				 min=n;
      if(min<=d)
	  {
	for(num=min;num<=d;num++)
	{
         count = 0;
         for(i=2;i<=num/2;i++)
		{
             if(num%i==0)
			 {
                 count++;
                 break;
             }
       	}
         if(count==0 && num!=k && num!=l && num!=m && num!=n)
             cnt2++;
	}
	printf("%d",d-cnt2-1);
	}
		else
			printf("0");
	}
}

#include<stdio.h>
int main()
{
    int k,l,m,n,d,i,j,b,find=0,x;

    scanf("%d %d %d %d %d",&k,&l,&m,&n,&d);
    int arr[d+1];

    if(k==1)
    {
        find=d;
    }
    if(k > d)
        find=0;
    else
    {
        for(b=1;b<=d;b++){
            arr[b]=0;
        }
        for(i=k;i<=d;i+=k){
            arr[i]=1;
            find++;

        }
        for(j=l;j<=d;j+=l){
            if(arr[j]==0){
                arr[j]=1;
                find++;

            }

        }
         for(x=n;x<=d;x+=n){

            if(arr[x]==0){
                find++;
            }
         }

    }
    printf("%d\n",find);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int k,l,m,n,d,i,brojac=0;
    int niz[10050]={0};
    scanf("%d%d%d%d%d",&k,&l,&m,&n,&d);
    if (k==1 || l==0 || m==0 || n==0)
    {
        printf("%d",d);
        return 0;
    }
    for (i=0; i<d; i=i+k)
            niz[i]=1;
    for (i=0; i<d; i=i+l)
            niz[i]=1;
    for (i=0; i<d; i=i+m)
            niz[i]=1;
    for (i=0; i<d; i=i+n)
            niz[i]=1;
    for (i=0; i<d; i=i++)
        if (niz[i]!=0)
            brojac++;
    printf("%d",brojac);
    return 0;
}

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

char * read_line();
void allocate_error();
short * remove_multiples(short * numbers, unsigned short * length);
unsigned short substract_mutiple_tortured_dragons(short * numbers, unsigned short * length, unsigned long dragons);

int main() {

	char * buffer = read_line();
	char * rest;

	short * numbers;
	unsigned short numbers_size = 4;
	unsigned long dragons;
	unsigned long solution = 0;

	numbers = malloc(sizeof(unsigned short) * numbers_size);
	if (numbers == NULL)
		allocate_error();

	// Saves the numbers
	for (unsigned short index=0; index<4; index++) {

		numbers[index] = (short) strtol(buffer, &rest, 10);
		free(buffer);
		buffer = read_line();
	}
	dragons = strtol(buffer, &rest, 10);
	free(buffer);

	// ----- SOLVE -----
	// Now we have to substract all dragons that got punised more than once
	// remove all multiples
	numbers = remove_multiples(numbers, &numbers_size);

	for (unsigned short index=0; index<numbers_size; index++) {
	}

    // Add all tortured dragons...
    for (unsigned short index=0; index<numbers_size; index++) {
        solution += (unsigned long) dragons / numbers[index];
    }

    if (numbers_size > 1) {
        // Now we need to substract all mutiple counted numbers
        solution -= substract_mutiple_tortured_dragons(numbers, &numbers_size, dragons);
    }

    printf("%lu\n", solution);
	return EXIT_SUCCESS;
}

char * read_line() {

	unsigned short buffersize = 10;
	unsigned short line_index = 0;

	char * line = malloc(buffersize);
	char * tmp;

	// ERROR
	if (line == NULL)
		allocate_error();
	// ERROR

	int character;

	while ((character = getchar()) != '\n' && character != EOF && buffersize < 65535) {

		// BUFFER IS TOO SMALL
		if (buffersize <= line_index + 1) {
			buffersize += 10;
			tmp = realloc(line, buffersize);

			// ERROR
			if (tmp == NULL)
				allocate_error();
			// ERROR

			line = tmp;
		}
		// BUFFER IS TOO SMALL

		line[line_index++] = (char) character;
	}

	// Set the end of the line
	line[line_index] = '\0';

	// Fit the allocated memory to the string lenght => No wasted memory
	tmp = realloc(line, strlen(line) + 1);

	// ERROR
	if (tmp == NULL)
		allocate_error();
	// ERROR

	line = tmp;
	return line;
}

void allocate_error() {
	perror("Couldn't allocate memory!");
	exit(1);
}

short * remove_multiples(short * numbers, unsigned short * length) {
    /*
     * This function will change the list `numbers` and will remove all mutiple numbers.
     */
    unsigned short amount_of_mutiples = 0;
    short * tmp;
    unsigned short tmp_index = 0;

    for (unsigned short index=0; index<*length; index++) {

        for(unsigned short control_index=index + 1; control_index<*length; control_index++) {
            // Found a mutiple!!!
            if (numbers[control_index] % numbers[index] == 0) {
                numbers[control_index] = -1;
                amount_of_mutiples++;
            }
        }

        // Now we must remove the mutiple numbers
        tmp = malloc(*length - amount_of_mutiples);

        // ERRROR
        if (tmp == NULL)
            allocate_error();
        // ERROR

        // now fill it with it's good numbers
        for (unsigned short get_single=0; get_single<*length; get_single++) {

            if (numbers[get_single] != -1)
                tmp[tmp_index++] = numbers[get_single];
        }
        free(numbers);

        // Now after removing the mutiples we can use it now
        numbers = tmp;
        *length -= amount_of_mutiples;
        amount_of_mutiples = 0;
        tmp_index = 0;
    }
    return numbers;
}

unsigned short substract_mutiple_tortured_dragons(short * numbers, unsigned short * length, unsigned long dragons) {
    /*
     * This function will substract the amount of dragons which got tortured more than once.
     */
    unsigned long amount_of_tortured_dragons_than_once = 0;

    /*
     * index1: This will focus on one number at the beginning.
     * index2: This will iterate through the other numbers.
     * All in one they should create every multiple which are possible to create with the numbers.
     */
    unsigned short index1;
    unsigned short index2;

    for(index1=0; index1<*length; index1++) {

        for (index2=index1 + 1; index2<*length; index2++) {

            if (numbers[index1])
            amount_of_tortured_dragons_than_once += (unsigned long) round(dragons / (numbers[index1] * numbers[index2]));
        }
    }
    return amount_of_tortured_dragons_than_once;
}