One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something. The following statement caught his attention: "Among any six people there are either three pairwise acquainted people or three pairwise unacquainted people"Igor just couldn't get why the required minimum is 6 people. "Well, that's the same for five people, too!" — he kept on repeating in his mind. — "Let's take, say, Max, Ilya, Vova — here, they all know each other! And now let's add Dima and Oleg to Vova — none of them is acquainted with each other! Now, that math is just rubbish!"Igor K. took 5 friends of his and wrote down who of them is friends with whom. Now he wants to check whether it is true for the five people that among them there are either three pairwise acquainted or three pairwise not acquainted people.

The first line contains an integer m (0 ≤ m ≤ 10), which is the number of relations of acquaintances among the five friends of Igor's. Each of the following m lines contains two integers ai and bi (1 ≤ ai, bi ≤ 5;ai ≠ bi), where (ai, bi) is a pair of acquainted people. It is guaranteed that each pair of the acquaintances is described exactly once. The acquaintance relation is symmetrical, i.e. if x is acquainted with y, then y is also acquainted with x.

Print "FAIL", if among those five people there are no either three pairwise acquainted or three pairwise unacquainted people. Otherwise print "WIN".

#include <stdio.h>
int main()
{
    int n, i, a[6]={0}, x, y;
    scanf("%d", &n);
    for(i=0; i<n; i++)
    {
        scanf("%d %d", &x, &y);
        a[x]++;
        a[y]++;
        if(a[x]==3 || a[y]==3)
        {
            printf("WIN\n");
            return 0;
        }
    }
    for(i=1; i<=5; i++)
        if(a[i]<=1)
        {
            printf("WIN\n");
            return 0;
        }
    printf("FAIL\n");
    return 0;
}

#include<stdio.h>

int main(void){
  int in1,in2,people[5];
  int m,n,i,flg=0;
  for(i=0;i<5;i++) people[i]=0;
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d %d",&in1,&in2);
    people[in1-1]++;
    people[in2-1]++;
  }
  for(i=0;i<5;i++){
    if(people[i]!=2){
      puts("WIN");
      flg=1;
      break;
    }
  }
  if(flg!=1) puts("FAIL");
  return 0;
}

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

int main(int argc, char *argv[])
{
	int i, j, k, relations[6][6] ;

	for (i = 0 ; i < 6 ; i++)
	{
		for (j = 0 ; j < 6 ; j++)
		{
			relations[i][j] = 0 ;
		}
	}

	scanf("%d", &k) ;

	while (k-- > 0)
	{
		scanf("%d %d", &i, &j) ;

		relations[i][j] = relations[j][i] = 1 ;
	}

	for (i = 1 ; i <= 3 ; i++)
	{
		for (j = i + 1 ; j <= 4 ; j++)
		{
			for (k = j + 1 ; k <= 5 ; k++)
			{
				if ((relations[i][j] && relations[j][k] && relations[k][i]) || !(relations[i][j] || relations[j][k] || relations[k][i]))
				{
					printf("WIN") ;
					return 0 ;
				}
			}
		}
	}

	printf("FAIL") ;

	return 0 ;
}

#include <stdio.h>
#include <string.h>
int main()
{
    int m;
    int i, j, k;
    int a, b;
    int map[11][11];
    while (scanf("%d", &m) == 1) {
        memset(map, 0, sizeof(map));
        for (i = 0; i < m; i++) {
            scanf("%d%d", &a, &b);
            map[a][b] = map[b][a] = 1;
        }
        for (i = 1; i <= 5; i++) {
        for (j = i+1; j <= 5; j++) {
        for (k = j+1; k <= 5; k++) {
            if (map[i][j] && map[j][k] && map[k][i]) {
                printf("WIN\n");
                goto X;
            }
            if (!map[i][j] && !map[j][k] && !map[k][i]) {
                printf("WIN\n");
                goto X;
            }
        }
        }
        }
        printf("FAIL\n");
X: ;
    }
    return 0;
}

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

int in(int a, int b);

int main()
{
        int r[10];
        int relations;
        int i;
        int x;
        int y;
        int one, two, three, four, five, six, seven, eight, nine, ten;

        for(i = 0; i < 10; i++)
        {
            r[i] = 0;
        }
        scanf("%d\n", &relations);
        for(i = 0; i < relations; i++)
        {
            scanf("%d %d\n", &x, &y);
            if(x < y)
                r[in(x,y)] = 1;
            else
                r[in(y,x)] = 1;
        }
/*
        for(i = 0; i < 10; i++)
            printf("%d\n", r[i]);
*/

        one = r[0]+r[1]+r[4];
        two = r[0]+r[2]+r[5];
        three = r[0]+r[3]+r[6];
        four =  r[1]+r[2]+r[7];
        five =  r[1]+r[3]+r[8];
        six =  r[2]+r[3]+r[9];
        seven =  r[4]+r[5]+r[7];
        eight =  r[4]+r[6]+r[8];
        nine =  r[5]+r[6]+r[9];
        ten =  r[7]+r[8]+r[9];

        /*printf("%d %d %d %d %d %d %d %d %d %d\n", one, two, three, four,
         * five, six, seven, eight, nine, ten);*/

        if((0 == one || 3 == one) || (0 == two || 3 ==two ) || (0 == three || 3 == three) || (0 == four || 3 == four) || (0 == five || 3 == five) || (0 == six || 3 == six) || (0 == seven || 3 == seven) || (0 == eight || 3 == eight) || (0 == nine || 3 == nine) || (0 == ten || 3 == ten))
            printf("WIN\n");
        else
            printf("FAIL\n");
}

/*return the index that the pair should be stored at*/
int in(int a, int b)
{
        if(1 == a)
        {
            if(2 == b)
                return 0;
            if(3 == b)
                return 1;
            if (4 == b)
                return 2;
            if (5 == b)
                return 3;
        }
        if (2 == a)
        {
            if(3 == b)
                return 4;
            if(4 == b)
                return 5;
            if(5 == b)
                return 6;
        }
        if (3 == a)
        {
            if(4 == b)
                return 7;
            if(5 == b)
                return 8;
        }
        if (4 == a)
        {
            if(5 == b)
                return 9;
        }
}

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

int a[6][6];
int color[6];

int dfs(int v, int h, int id){
    int i, ans = 0;
    if (h > 3){
        return 0;
    }
    color[v] = h;
    for (i = 1; i < 6; i++){
        if (abs(id - a[v][i])){
            if (!color[i]){
                ans += dfs(i, h + 1, id);
            }else{
                if (h == 3 && color[i] == 1){
                    return 1;
                }
            }
        }
    }
    return ans;
}
int predfs(int id){
    int i, j, ans = 0;
    for (i = 1; i < 6; i++){
        for (j = 1; j < 6; j++){
            color[j] = 0;
        }
        if (!color[i]){
            ans += dfs(i, 1, id);
        }
    }
    return ans;
}
int main(void)
{
    int m, c, b = 1, i, j;
    scanf("%d", &m);
    for (i = 1; i < 6; i++){
        for (j = j; j < 6; j++){
            a[i][j] = 0;
        }
    }
    for (i = 0; i < m; i++){
        scanf("%d%d", &c, &b);
        a[c][b] = a[b][c] = 1;
    }
    if (predfs(1) || predfs(0)){
        printf("WIN");
    } else{
        printf("FAIL");
    }
    return 0;
}

#include<stdio.h>

int main()
{
    int m,i,a[10]={0},l,r;
    scanf("%d",&m);
    while(m--)
    {
        scanf("%d%d",&l,&r);
        a[l]++;
        a[r]++;
    }
    for(i=1;i<=5;i++)
        if(a[i]>=3 || a[i]<2)
            break;
    if(i==6)
        printf("FAIL\n");
    else
        printf("WIN\n");
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
	int m,i,a,b,x[10]={0};
	scanf("%d",&m);

		for(i=0;i<m;i++)
		{
			scanf("%d%d",&a,&b);
			x[a]++;x[b]++;
		}
		for(i=1;i<=5;i++)
		{
			if(x[i]!=2)
			{
				break;
			}
		}
		if(i>5)
		{
			printf("FAIL\n");
		}
		else
		{
			printf("WIN\n");
		}

	return 0;
}

/**
   nayeem
   dated, dhaka,
   30th June, 2011
   Codeforces 76
   Div 2
   B: Friends
**/

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

int p[] = {1, 2, 3, 4, 5};
int ans[3];
int G[6][6];

int backtrack(int ind, int pos)
{
    int i, j, node, w[3];
    if (pos == 3)
    {
       memset(w, 0, sizeof(w));
       node = ans[0];
       if (G[node][ans[1]] && G[node][ans[2]]) w[0] = 2;
       node = ans[1];
       if (G[node][ans[0]] && G[node][ans[2]]) w[1] = 2;
       node = ans[2];
       if (G[node][ans[0]] && G[node][ans[1]]) w[2] = 2;
       if (w[0] + w[1] + w[2] == 6)
       {
           return 1;
       }

       memset(w, -1, sizeof(w));
       node = ans[0];
       if (!G[node][ans[1]] && !G[node][ans[2]]) w[0] = 0;
       node = ans[1];
       if (!G[node][ans[0]] && !G[node][ans[2]]) w[1] = 0;
       node = ans[2];
       if (!G[node][ans[0]] && !G[node][ans[1]]) w[2] = 0;
       if (w[0] + w[1] + w[2] == 0)
       {
            return 1;
       }
       return 0;
    }
    for (i=ind; i<5; i++)
    {
        ans[pos] = p[i];
        if (backtrack(i + 1, pos + 1)) return 1;
    }
    return 0;
}

int main(void)
{
    int m, i, j, u, v;
    /*
    freopen("C:\\input.txt", "rt", stdin);
    freopen("C:\\output.txt", "wt", stdout);
    */
    while (1 == scanf("%d", &m))
    {
          memset(G, 0, sizeof(G));
          for (i=1; i<=m; i++)
          {
              scanf("%d %d", &u, &v);
              G[u][v] = 1;
              G[v][u] = 1;
          }

          if (backtrack(0, 0))
              printf("WIN\n");
          else
              printf("FAIL\n");
    }

    return 0;
}

/*
    Tardes de Coding Sesión 3
    B - Friends
    A01208964 - Doménica Rentería
*/

#include <stdio.h>

#define amigos 5

int main(){

int arr[amigos] = {};
int m, a, b;
// m -> # de relaciones entre los 5 amixes
// (a, b) relacion
// a -> persona 1
// b -> persona 2

scanf("%i", &m);
if (m == 0){
	printf("WIN\n");
	return 0;
}

int i=0;

// con este do-while, vamos a contar el numero de relaciones por persona
// con base a su número, si sale, se le suma al arreglo en su posición

do {
	scanf("%i %i", &a, &b);
    arr[a-1]++;
    //printf("arr[%i-1]++ %i\n", a, arr[a-1]++);
    arr[b-1]++;
    //printf("arr[%i-1]++ %i\n", b, arr[b-1]++);
	i++;
} while (i < m);

i=0;

// en este do-while checamos todo el arreglo
// si alguno tiene un valor diferente

do {
	if(arr[i] != 2){
    	printf("WIN\n");
    	return 0;
    }
	i++;
} while (i < amigos);

printf("FAIL\n");

return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int		main()
{
	int n_cone, i = 0, cont[6];
	scanf("%d", &n_cone);
	int l, r;
	int cnt = 0;
	int	tab[6];
	char *res = "FAIL";
	memset(tab, 0, sizeof(tab));
	while (n_cone > i)
	{
		scanf("%d%d", &l, &r);
		tab[l] = tab[l] + 1;
		tab[r] = tab[r] + 1;
		i++;
	}
	i = 1;
	while (i <= 5)
	{
		if (tab[i] != 2)
			res = "WIN";
		i++;
	}
	printf("%s", res);
	exit(0);
}

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

int main()
{
    int relations=0;
    int valor, aux, aux2, cont=0,  bandera=0;
    int n1=0, n2=0, n3=0, n4=0, n5=0;
    scanf("%i%*c", &relations);
    int pairwise[relations][2];

    int i=0, x=0;
    int j=0;
    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
                scanf("%i%*c", &valor);
                pairwise[i][j]=valor;
        }
    }

     if(relations<=4){
        printf("WIN");
     }
     else {
     /*aux=pairwise[0][0];
     aux2=pairwise[0][1];
    for(i=0; i<relations; i++){
            if(pairwise[i][0]==aux2){
               aux=pairwise[i][0];
               aux2=pairwise[i][1];
               cont++;
            }
            else if (pairwise[i][0]==aux){
                aux=pairwise[i][0];
                aux2=pairwise[i][1];
                cont++;
            }
            else{
                aux=pairwise[x++][0];
                aux2=pairwise[x][1];
                cont=0;
            }
    }*/

    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
           if(pairwise[i][j]==1){
            n1=n1+1;
           }
           else if(pairwise[i][j]==2){
            n2=n2+1;
           }
           else if(pairwise[i][j]==3){
            n3=n3+1;
           }
           else if(pairwise[i][j]==4){
            n4=n4+1;
           }
           else {
            n5=n5+1;
           }
        }
    }

    if(n1 >= 3 || n2 >= 3 ||  n3 >= 3  || n4 >= 3 || n5 >= 3 ){
        printf("WIN");
    }
    else printf("FAIL");
     }

}

#include <stdio.h>

int main(){
  int tabla[5][5];
  for(int i = 0; i < 5; i++){
    for(int j = 0; j < 5; j++){
      tabla[i][j] = 0;
    }
  }
  int n;
  scanf("%d", &n);

  for(int i = 0; i < n; i++){
    int a,b;
    scanf("%d %d", &a, &b);
    tabla[a-1][b-1] = 1;
    tabla[b-1][a-1] = 1;
  }

  int Igaz = 0;
  int Hamis = 0;

  for(int i = 0; i < 4; i++){
    for(int j = i+1; j < 5; j++){
      //printf("i:%d, j: %d\n", i, j);
      /* jarjuk be a tablat */
      int Helyes = 1;
      int Helytelen = 1;
      for(int k = 0; k < 5; k++){
	for(int l = 0; l < 5; l++){
	  if(!(k == i || k == j || l == i || l == j) && (k != l)){
	    //printf("k:%d, l: %d\n", k, l);
	    if(tabla[k][l] != 1) Helyes = 0;
	    if(tabla[k][l] == 1) Helytelen = 0;
	  }
	}
      }
      if(Helyes) Igaz = 1;
      if(Helytelen) Hamis = 1;

    }
  }

  if(Igaz || Hamis) printf("WIN");
  else printf("FAIL");
}

#include <stdio.h>
int main()
{
    int n, i, a[6]={0}, x, y;
    scanf("%d", &n);
    for(i=0; i<n; i++)
    {
        scanf("%d %d", &x, &y);
        a[x]++;
        a[y]++;
        if(a[x]==3 || a[y]==3)
        {
            printf("WIN\n");
            return 0;
        }
    }
    for(i=1; i<=5; i++)
        if(a[i]==1)
        {
            printf("WIN\n");
            return 0;
        }
    printf("FAIL\n");
    return 0;
}

#include<stdio.h>

int main(void){
  int in1,in2,people[5];
  int m,n,i,flg=0;
  for(i=0;i<5;i++) people[i]=0;
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d %d",&in1,&in2);
    people[in1]++;
    people[in2]++;
  }
  for(i=0;i<5;i++){
    if(people[i]==1 || people[i]==3){
      puts("WIN");
      flg=1;
      break;
    }
  }
  if(flg!=1) puts("FAIL");
  return 0;
}

#include<stdio.h>

int main(void){
  int in1,in2,people[5];
  int m,n,i,flg=0;
  for(i=0;i<5;i++) people[i]=0;
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d %d",&in1,&in2);
    people[in1-1]++;
    people[in2-1]++;
  }
  for(i=0;i<5;i++){
    if(people[i]==1 || people[i]==3){
      puts("WIN");
      flg=1;
      break;
    }
  }
  if(flg!=1) puts("FAIL");
  return 0;
}

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

int quantidade_de_amigos(int *amigos) {

	int i;

	for(i = 0; i < 5; i++) {

		if(amigos[i] >= 3) {
			return 1;
		}
	}

	return 0;
}

void percorre_vetor(int *v, int n, int *amigos) {

	int i, j, elemento = 1, contador;
	contador = 0;

	for(i = 0; i < 5; i++) {

		contador = 0;
		for(j = 0; j < n; j++) {

			if(v[j] == elemento) {
				contador++;
			}
		}

		amigos[i] = contador;
		elemento++;
	}
}

int main() {

	int i, n;

	scanf("%d", &n);

	int *v = (int*) malloc((2 * n) * sizeof(int));
	int *amigos = (int*) malloc(5 * sizeof(int));

	for(i = 0; i < (2 * n); i++) {

		scanf("%d", &v[i]);
	}

	percorre_vetor(v, (2 * n), amigos);

	if(n == 1) {
		printf("WIN\n");
	}
	else if(quantidade_de_amigos(amigos)) {
		printf("WIN\n");
	}
	else {
		printf("FAIL\n");
	}

	free(v);
	free(amigos);

	return 0;
}

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

int quantidade_de_amigos(int *amigos) {

	int i;

	for(i = 0; i < 5; i++) {

		if(amigos[i] >= 3) {
			return 1;
		}
	}

	return 0;
}

void percorre_vetor(int *v, int n, int *amigos) {

	int i, j, elemento = 1, contador;
	contador = 0;

	for(i = 0; i < 5; i++) {

		contador = 0;
		for(j = 0; j < n; j++) {

			if(v[j] == elemento) {
				contador++;
			}
		}

		amigos[i] = contador;
		elemento++;
	}
}

int main() {

	int i, n;

	scanf("%d", &n);

	int *v = (int*) malloc((2 * n) * sizeof(int));
	int *amigos = (int*) malloc(5 * sizeof(int));

	for(i = 0; i < (2 * n); i++) {

		scanf("%d", &v[i]);
	}

	percorre_vetor(v, (2 * n), amigos);

	if(quantidade_de_amigos(amigos)) {
		printf("WIN\n");
	}
	else {
		printf("FAIL\n");
	}

	free(v);
	free(amigos);

	return 0;
}

#include <stdio.h>
#include <string.h>
int main()
{
    int m;
    int i, j, k;
    int a, b;
    int map[11][11];
    while (scanf("%d", &m) == 1 && m) {
        memset(map, 0, sizeof(map));
        for (i = 0; i < m; i++) {
            scanf("%d%d", &a, &b);
            map[a][b] = map[b][a] = 1;
        }
        for (i = 1; i <= 5; i++) {
        for (j = i+1; j <= 5; j++) {
        for (k = j+1; k <= 5; k++) {
            if (map[i][j] && map[j][k] && map[k][i]) {
                printf("WIN\n");
                goto X;
            }
            if (!map[i][j] && !map[j][k] && !map[k][i]) {
                printf("WIN\n");
                goto X;
            }
        }
        }
        }
        printf("FAIL\n");
X: ;
    }
    return 0;
}

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

int a[6][6];
int color[6];

int dfs(int v, int h, int id){
    int i, ans = 0;
    color[v] = h;
    for (i = 1; i < 6; i++){
        if (abs(id - a[v][i])){
            if (!color[i]){
                ans += dfs(i, h + 1, id);
            }else{
                if (h + 1 - color[i] == 3){
                    ans = 1;
                }
            }
        }
    }
    return ans;
}
int predfs(int id){
    int i, ans = 0;
    for (i = 1; i < 6; i++){
        color[i] = 0;
    }
    for (i = 1; i < 6; i++){
        if (!color[i]){
            ans += dfs(i, 1, id);
        }
    }
    return ans;
}
int main(void)
{
    int m, c, b = 1, i, j;
    scanf("%d", &m);
    for (i = 1; i < 6; i++){
        for (j = j; j < 6; j++){
            a[i][j] = 0;
        }
    }
    for (i = 0; i < m; i++){
        scanf("%d%d", &c, &b);
        a[c][b] = a[b][c] = 1;
    }
    if (predfs(1) || predfs(0)){
        printf("WIN");
    } else{
        printf("FAIL");
    }
    return 0;
}

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

int a[6][6];
int color[6];

int dfs(int v, int h, int id){
    int i, ans = 0;
    color[v] = h;
    for (i = 1; i < 6; i++){
        if (abs(id - a[v][i])){
            if (!color[i]){
                ans += dfs(i, h + 1, id);
            }else{
                if (h + 1 - color[i] == 3){
                    ans = 1;
                }
            }
        }
    }
    return ans;
}

int main(void)
{
    int m, c, b, i, j;
    scanf("%d", &m);
    for (i = 1; i < 6; i++){
        for (j = j; j < 6; j++){
            a[i][j] = 0;
        }
    }
    for (i = 0; i < m; i++){
        scanf("%d%d", &c, &b);
        a[c][b] = a[b][c] = 1;
    }
    if (dfs(b, 1, 1) || dfs(b, 1, 0)){
        printf("WIN");
    } else{
        printf("FAIL");
    }
    return 0;
}

/*
    Tardes de Coding Sesión 3
    B - Friends
    A01208964 - Doménica Rentería
*/

#include <stdio.h>

#define amigos 5

int main(){

int arr[amigos] = {};
int m, a, b;
// m -> # de relaciones entre los 5 amixes
// (a, b) relacion
// a -> persona 1
// b -> persona 2

scanf("%i", &m);

int i=0;

// con este do-while, vamos a contar el numero de relaciones por persona
// con base a su número, si sale, se le suma al arreglo en su posición

do {
	scanf("%i %i", &a, &b);
    arr[a-1]++;
    //printf("arr[%i-1]++ %i\n", a, arr[a-1]++);
    arr[b-1]++;
    //printf("arr[%i-1]++ %i\n", b, arr[b-1]++);
	i++;
} while (i < m);

i=0;

// en este do-while checamos todo el arreglo
// si alguno tiene un valor diferente

do {
	if(arr[i] > 2){
    	printf("WIN\n");
    	return 0;
    }
	i++;
} while (i < amigos);

printf("FAIL\n");

return 0;
}

/*
    Tardes de Coding Sesión 3
    B - Friends
    A01208964 - Doménica Rentería
*/

#include <stdio.h>

#define amigos 5

int main(){

int arr[amigos] = {};
int m, a, b;
// m -> # de relaciones entre los 5 amixes
// (a, b) relacion
// a -> persona 1
// b -> persona 2

scanf("%i", &m);
if (m==0){
	return 0;
}

int i=0;

// con este do-while, vamos a contar el numero de relaciones por persona
// con base a su número, si sale, se le suma al arreglo en su posición

do {
	scanf("%i %i", &a, &b);
    arr[a-1]++;
    //printf("arr[%i-1]++ %i\n", a, arr[a-1]++);
    arr[b-1]++;
    //printf("arr[%i-1]++ %i\n", b, arr[b-1]++);
	i++;
} while (i < m);

i=0;

// en este do-while checamos todo el arreglo
// si alguno tiene un valor diferente

do {
	if(arr[i] != 2){
    	printf("WIN\n");
    	return 0;
    }
	i++;
} while (i < amigos);

printf("FAIL\n");

return 0;
}

/*
    Tardes de Coding Sesión 3
    B - Friends
    A01208964 - Doménica Rentería
*/

#include <stdio.h>

#define amigos 5

int main(){

int arr[amigos] = {};
int m, a, b;
// m -> # de relaciones entre los 5 amixes
// (a, b) relacion
// a -> persona 1
// b -> persona 2

scanf("%i", &m);
if (m=0){
	return 0;
}

int i=0;

// con este do-while, vamos a contar el numero de relaciones por persona
// con base a su número, si sale, se le suma al arreglo en su posición

do {
	scanf("%i %i", &a, &b);
    arr[a-1]++;
    //printf("arr[%i-1]++ %i\n", a, arr[a-1]++);
    arr[b-1]++;
    //printf("arr[%i-1]++ %i\n", b, arr[b-1]++);
	i++;
} while (i < m);

i=0;

// en este do-while checamos todo el arreglo
// si alguno tiene un valor diferente

do {
	if(arr[i] != 2){
    	printf("WIN\n");
    	return 0;
    }
	i++;
} while (i < amigos);

printf("FAIL\n");

return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int		main()
{
	int n_cone, i = 0, cont[6];

	scanf("%d", &n_cone);
	int l, r;
	int cnt = 0;
	int	tab[5];
	char *res = "FAIL";
	memset(tab, 0, sizeof(tab));
	while (n_cone > i)
	{
		scanf("%d%d", &l, &r);
		tab[l] = tab[l] + 1;
		tab[r] = tab[r] + 1;
		i++;
	}
	i = 1;
	while (i <= 5)
	{
		if (tab[i] != 2)
			res = "WIN";
		i++;
	}
		printf("%s", res);
	exit(0);
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int		main()
{
	int n_cone, i = 0, cont[6];

	scanf("%d", &n_cone);
	int l, r;
	int cnt = 0;
	int	tab[5];
	char *res = "FAIL";
	memset(tab, 0, sizeof(tab));
	while (n_cone > i)
	{
		scanf("%d%d", &l, &r);
		tab[l] = tab[l] + 1;
		tab[r] = tab[r] + 1;
		i++;
	}
	i = 1;
	while (i <= 5)
	{
		if (tab[i] != 2)
			res = "WIN";
		i++;
	}
	if (strcmp(res, "FAIL"))
		printf("WIN");
	else
		printf("FAIL\n");
	exit(0);
}

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

int main()
{
    int relations=0;
    int valor, aux, aux2, cont=0,  bandera=0;
    int n1=0, n2=0, n3=0, n4=0, n5=0;
    scanf("%i%*c", &relations);
    int pairwise[relations][2];

    int i=0, x=0;
    int j=0;
    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
                scanf("%i%*c", &valor);
                pairwise[i][j]=valor;
        }
    }

     if(relations<4){
        printf("WIN");
     }
     else {
     aux=pairwise[0][0];
     aux2=pairwise[0][1];
    for(i=0; i<relations; i++){
            if(pairwise[i][0]==aux2){
               aux=pairwise[i][0];
               aux2=pairwise[i][1];
               cont++;
            }
            else if (pairwise[i][0]==aux){
                aux=pairwise[i][0];
                aux2=pairwise[i][1];
                cont++;
            }
            else{
                aux=pairwise[x++][0];
                aux2=pairwise[x][1];
                cont=0;
            }
    }

    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
           if(pairwise[i][j]==1){
            n1=n1+1;
           }
           else if(pairwise[i][j]==2){
            n2=n2+1;
           }
           else if(pairwise[i][j]==3){
            n3=n3+1;
           }
           else if(pairwise[i][j]==4){
            n4=n4+1;
           }
           else {
            n5=n5+1;
           }
        }
    }

    if(n1 >= 3 || n2 >= 3 ||  n3 >= 3  || n4 >= 3 || n5 >= 3){
        printf("WIN");
    }
    else printf("FAIL");
     }

}

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

int main()
{
    int relations=0;
    int valor, aux, aux2, cont=0,  bandera=0;
    int n1=0, n2=0, n3=0, n4=0, n5=0;
    scanf("%i%*c", &relations);
    int pairwise[relations][2];

    int i=0, x=0;
    int j=0;
    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
                scanf("%i%*c", &valor);
                pairwise[i][j]=valor;
        }
    }

     aux=pairwise[0][0];
     aux2=pairwise[0][1];

    for(i=0; i<relations; i++){
            if(pairwise[i][0]==aux2){
               aux=pairwise[i][0];
               aux2=pairwise[i][1];
               cont++;
            }
            else if (pairwise[i][0]==aux){
                aux=pairwise[i][0];
                aux2=pairwise[i][1];
                cont++;
            }
            else{
                aux=pairwise[x++][0];
                aux2=pairwise[x][1];
                cont=0;
            }
    }

    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
           if(pairwise[i][j]==1){
            n1=n1+1;
           }
           else if(pairwise[i][j]==2){
            n2=n2+1;
           }
           else if(pairwise[i][j]==3){
            n3=n3+1;
           }
           else if(pairwise[i][j]==4){
            n4=n4+1;
           }
           else {
            n5=n5+1;
           }
        }
    }

    if(n1 ==3 || n2 == 3 ||  n3 ==3  || n4 == 3 || n5 == 3  || cont ==3 ){
        printf("WIN");
    }
    else printf("FAIL");

}

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

int main()
{
    int relations=0;
    int valor, aux, aux2, cont=0,  bandera=0;
    int n1=0, n2=0, n3=0, n4=0, n5=0;
    scanf("%i%*c", &relations);
    int pairwise[relations][2];

    int i=0, x=0;
    int j=0;
    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
                scanf("%i%*c", &valor);
                pairwise[i][j]=valor;
        }
    }

     if(relations<4){
        printf("WIN");
     }
     else {
    /* aux=pairwise[0][0];
     aux2=pairwise[0][1];
    for(i=0; i<relations; i++){
            if(pairwise[i][0]==aux2){
               aux=pairwise[i][0];
               aux2=pairwise[i][1];
               cont++;
            }
            else if (pairwise[i][0]==aux){
                aux=pairwise[i][0];
                aux2=pairwise[i][1];
                cont++;
            }
            else{
                aux=pairwise[x++][0];
                aux2=pairwise[x][1];
                cont=0;
            }
    }*/

    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
           if(pairwise[i][j]==1){
            n1=n1+1;
           }
           else if(pairwise[i][j]==2){
            n2=n2+1;
           }
           else if(pairwise[i][j]==3){
            n3=n3+1;
           }
           else if(pairwise[i][j]==4){
            n4=n4+1;
           }
           else {
            n5=n5+1;
           }
        }
    }

    if(n1 >= 3 || n2 >= 3 ||  n3 >= 3  || n4 >= 3 || n5 >= 3){
        printf("WIN");
    }
    else printf("FAIL");
     }

}

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

int main()
{
    int relations=0;
    int valor, aux, aux2, cont=0,  bandera=0;
    int n1=0, n2=0, n3=0, n4=0, n5=0;
    scanf("%i%*c", &relations);
    int pairwise[relations][2];

    int i=0, x=0;
    int j=0;
    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
                scanf("%i%*c", &valor);
                pairwise[i][j]=valor;
        }
    }

     aux=pairwise[0][0];
     aux2=pairwise[0][1];
     if(relations==1){
        printf("WIN");
     }
     else {
    for(i=0; i<relations; i++){
            if(pairwise[i][0]==aux2){
               aux=pairwise[i][0];
               aux2=pairwise[i][1];
               cont++;
            }
            else if (pairwise[i][0]==aux){
                aux=pairwise[i][0];
                aux2=pairwise[i][1];
                cont++;
            }
            else{
                aux=pairwise[x++][0];
                aux2=pairwise[x][1];
                cont=0;
            }
    }

    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
           if(pairwise[i][j]==1){
            n1=n1+1;
           }
           else if(pairwise[i][j]==2){
            n2=n2+1;
           }
           else if(pairwise[i][j]==3){
            n3=n3+1;
           }
           else if(pairwise[i][j]==4){
            n4=n4+1;
           }
           else {
            n5=n5+1;
           }
        }
    }

    if(n1 ==3 || n2 == 3 ||  n3 ==3  || n4 == 3 || n5 == 3  || cont ==3 ){
        printf("WIN");
    }
    else printf("FAIL");
     }

}

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

int main()
{
    int relations=0;
    int valor, aux, aux2, cont=0,  bandera=0;
    int n1=0, n2=0, n3=0, n4=0, n5=0;
    scanf("%i%*c", &relations);
    int pairwise[relations][2];

    int i=0, x=0;
    int j=0;
    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
                scanf("%i%*c", &valor);
                pairwise[i][j]=valor;
        }
    }

     aux=pairwise[0][0];
     aux2=pairwise[0][1];
     if(relations<4){
        printf("WIN");
     }
     else {
    for(i=0; i<relations; i++){
            if(pairwise[i][0]==aux2){
               aux=pairwise[i][0];
               aux2=pairwise[i][1];
               cont++;
            }
            else if (pairwise[i][0]==aux){
                aux=pairwise[i][0];
                aux2=pairwise[i][1];
                cont++;
            }
            else{
                aux=pairwise[x++][0];
                aux2=pairwise[x][1];
                cont=0;
            }
    }

    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
           if(pairwise[i][j]==1){
            n1=n1+1;
           }
           else if(pairwise[i][j]==2){
            n2=n2+1;
           }
           else if(pairwise[i][j]==3){
            n3=n3+1;
           }
           else if(pairwise[i][j]==4){
            n4=n4+1;
           }
           else {
            n5=n5+1;
           }
        }
    }

    if(n1 ==3 || n2 == 3 ||  n3 ==3  || n4 == 3 || n5 == 3  || cont ==3 ){
        printf("WIN");
    }
    else printf("FAIL");
     }

}

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

int main()
{
    int relations=0;
    int valor, aux, aux2, cont=0,  bandera=0;
    int n1=0, n2=0, n3=0, n4=0, n5=0;
    scanf("%i%*c", &relations);
    int pairwise[relations][2];

    int i=0, x=0;
    int j=0;
    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
                scanf("%i%*c", &valor);
                pairwise[i][j]=valor;
        }
    }

     if(relations<4){
        printf("WIN");
     }
     else {
    /* aux=pairwise[0][0];
     aux2=pairwise[0][1];
    for(i=0; i<relations; i++){
            if(pairwise[i][0]==aux2){
               aux=pairwise[i][0];
               aux2=pairwise[i][1];
               cont++;
            }
            else if (pairwise[i][0]==aux){
                aux=pairwise[i][0];
                aux2=pairwise[i][1];
                cont++;
            }
            else{
                aux=pairwise[x++][0];
                aux2=pairwise[x][1];
                cont=0;
            }
    }*/

    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
           if(pairwise[i][j]==1){
            n1=n1+1;
           }
           else if(pairwise[i][j]==2){
            n2=n2+1;
           }
           else if(pairwise[i][j]==3){
            n3=n3+1;
           }
           else if(pairwise[i][j]==4){
            n4=n4+1;
           }
           else {
            n5=n5+1;
           }
        }
    }

    if(n1 > 3 || n2 > 3 ||  n3 > 3  || n4 > 3 || n5 > 3  || cont ==3 ){
        printf("WIN");
    }
    else printf("FAIL");
     }

}

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

int main()
{
    int relations=0;
    int valor, aux, aux2, cont=0,  bandera=0;
    int n1=0, n2=0, n3=0, n4=0, n5=0;
    scanf("%i%*c", &relations);
    int pairwise[relations][2];

    int i=0, x=0;
    int j=0;
    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
                scanf("%i%*c", &valor);
                pairwise[i][j]=valor;
        }
    }

     if(relations<4){
        printf("WIN");
     }
     else {
     aux=pairwise[0][0];
     aux2=pairwise[0][1];
    for(i=0; i<relations; i++){
            if(pairwise[i][0]==aux2){
               aux=pairwise[i][0];
               aux2=pairwise[i][1];
               cont++;
            }
            else if (pairwise[i][0]==aux){
                aux=pairwise[i][0];
                aux2=pairwise[i][1];
                cont++;
            }
            else{
                aux=pairwise[x++][0];
                aux2=pairwise[x][1];
                cont=0;
            }
    }

    for(i=0; i<relations; i++){
        for(j=0; j<2; j++){
           if(pairwise[i][j]==1){
            n1=n1+1;
           }
           else if(pairwise[i][j]==2){
            n2=n2+1;
           }
           else if(pairwise[i][j]==3){
            n3=n3+1;
           }
           else if(pairwise[i][j]==4){
            n4=n4+1;
           }
           else {
            n5=n5+1;
           }
        }
    }

    if(n1 >= 3 || n2 >= 3 ||  n3 >= 3  || n4 >= 3 || n5 >= 3  || cont >= 3){
        printf("WIN");
    }
    else printf("FAIL");
     }

}

#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int tabla[5][5];
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      tabla[i][j] = 0;
    }
  }
  for(int i = 0; i < n; i++){
    int a,b;
    scanf("%d %d", &a, &b);
    tabla[a-1][b-1] = 1;
    tabla[b-1][a-1] = 1;
  }

  int Igaz = 0;

  for(int i = 0; i < 4; i++){
    for(int j = i+1; j < 5; j++){
      //printf("i:%d, j: %d\n", i, j);
      /* jarjuk be a tablat */
      int Helyes = 1;
      int Helytelen = 1;
      for(int k = 0; k < 5; k++){
	for(int l = 0; l < 5; l++){
	  if(!(k == i || k == j || l == i || l == j)){
	    //printf("k:%d, l: %d\n", k, l);
	    if(tabla[k][l] != 1) Helyes = 0;
	    if(tabla[k][l] == 1) Helytelen = 0;
	  }
	}
      }
      //if(Helyes) printf("helyes\n");
      //if(Helytelen) printf("helytelen\n");
      if(Helyes || Helytelen){
	Igaz = 1;
      }

    }
  }

  if(Igaz) printf("WIN");
  else printf("FAIL");
}


You are given a tree with $$$n$$$ nodes. You have to write non-negative integers on its edges so that the following condition would be satisfied:For every two nodes $$$i$$$, $$$j$$$, look at the path between them and count the sum of numbers on the edges of this path. Write all obtained sums on the blackboard. Then every integer from $$$1$$$ to $$$\lfloor \frac{2n^2}{9} \rfloor$$$ has to be written on the blackboard at least once. It is guaranteed that such an arrangement exists.

The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of nodes. Each of the next $$$n-1$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \le u, v \le n$$$, $$$u \neq v$$$), meaning that there is an edge between nodes $$$u$$$ and $$$v$$$. It is guaranteed that these edges form a tree.

Output $$$n-1$$$ lines, each of form $$$u$$$ $$$v$$$ $$$x$$$ ($$$0 \le x \le 10^6$$$), which will mean that you wrote number $$$x$$$ on the edge between $$$u$$$, $$$v$$$.  Set of edges $$$(u, v)$$$ has to coincide with the set of edges of the input graph, but you can output edges in any order. You can also output ends of edges in an order different from the order in input.

NoteIn the first example, distance between nodes $$$1$$$ and $$$2$$$ is equal to $$$2$$$, between nodes $$$2$$$ and $$$3$$$ to $$$1$$$, between $$$1$$$ and $$$3$$$ to $$$3$$$.In the third example, numbers from $$$1$$$ to $$$9$$$ (inclusive) will be written on the blackboard, while we need just from $$$1$$$ to $$$5$$$ to pass the test.

/* https://codeforces.com/contest/1206/submission/59041923 (Dukkha) */
#include <stdio.h>
#include <stdlib.h>

#define N	1000

int next[1 + (N - 1) * 2], jj[1 + (N - 1) * 2];

int link(int l, int j) {
	static int l_ = 1;

	next[l_] = l;
	jj[l_] = j;
	return l_++;
}

int n;
int ao[N], cc[N];
int i_, j_, n_;

int dfs(int p, int i) {
	int l, j, c_, c;

	c = 1;
	for (l = ao[i]; l; l = next[l]) {
		j = jj[l];
		if (j != p)
			c += dfs(i, j);
	}
	c_ = c < n - c ? c : n - c;
	if (n_ < c_) {
		n_ = c_;
		if (c <= n - c) {
			i_ = i;
			j_ = p;
		} else {
			i_ = p;
			j_ = i;
		}
	}
	cc[i] = c;
	return c;
}

int compare(const void *a, const void *b) {
	int i = *(int *) a;
	int j = *(int *) b;

	return cc[i] - cc[j];
}

int a, b;

void dfs_(int p, int i, int c) {
	int l, j;

	a += b;
	printf("%d %d %d\n", p + 1, i + 1, a - c);
	c = a;
	for (l = ao[i]; l; l = next[l]) {
		j = jj[l];
		if (j != p)
			dfs_(i, j, c);
	}
}

int main() {
	static int tt[N];
	int h, i, j, k, l, s, n_, changed;

	scanf("%d", &n);
	for (h = 0; h < n - 1; h++) {
		scanf("%d%d", &i, &j), i--, j--;
		ao[i] = link(ao[i], j);
		ao[j] = link(ao[j], i);
	}
	i_ = -1, j_ = -1, n_ = -1;
	dfs(-1, 0);
	s = j_;
	dfs(-1, s);
	k = 0;
	for (l = ao[s]; l; l = next[l])
		tt[k++] = jj[l];
	qsort(tt, k, sizeof *tt, compare);
	n_ = 1;
	b = 1, a = 0;
	changed = 0;
	for (h = 0; h < k; h++) {
		j = tt[h];
		dfs_(s, j, 0);
		n_ += cc[j];
		if (!changed && n_ * 3 >= n) {
			changed = 1;
			b = n_, a = 0;
		}
	}
	return 0;
}


«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.However, just counting dragons was boring as well, so she entertained herself at best she could. Tonight she imagined that all dragons were here to steal her, and she was fighting them off. Every k-th dragon got punched in the face with a frying pan. Every l-th dragon got his tail shut into the balcony door. Every m-th dragon got his paws trampled with sharp heels. Finally, she threatened every n-th dragon to call her mom, and he withdrew in panic.How many imaginary dragons suffered moral or physical damage tonight, if the princess counted a total of d dragons?

Input data contains integer numbers k, l, m, n and d, each number in a separate line (1 ≤ k, l, m, n ≤ 10, 1 ≤ d ≤ 105).

NoteIn the first case every first dragon got punched with a frying pan. Some of the dragons suffered from other reasons as well, but the pan alone would be enough.In the second case dragons 1, 7, 11, 13, 17, 19 and 23 escaped unharmed.

#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 <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>

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 <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 <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>
/*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>
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()
{

	#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>
#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>
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>
#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>
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,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, 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 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>
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;
    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,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>
#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<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>
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);}

#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);
}

/*
 * 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>
#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>
#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>
#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,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>
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 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 <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>
#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>
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;

}

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

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>

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>
#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%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>
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;
}

#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;
	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 <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>
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>
#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>
#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>
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>
#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;
}