#include<stdio.h>
#include<string.h>
char A[101],B[] = "CODEFORCES",src[101],dest[11];
int main(){
	scanf("%s",A);
	int l=strlen(A),i,f=0,j=0,k,g=0,h;
	for(i=0;i<l;i++){
        if(A[i]!=B[j])f=1;
        else {
         j++;
         if(j==10){
           printf("YES");return 0;}
        if(f==1){
            //strcpy(src,A+i);
            //strcpy(dest,B+j);
            //if(strstr(src,dest)){
                k=j;
                for(i=i;i<l;i++){
                    if(A[i]==B[k]){
                        k++;g=1;
                        if(k==10&&i==l-1){
                            printf("YES");
                            return 0;
                        }
                    }
                    else {
                        if(g==1)k=j;
                        continue;
                    }
                }
                //if(A[h+10-j]=='\0'){
                    //printf("YES");
                    //return 0;
                //}
                //else{
                    //printf("NO");
                    //return 0;
                //}
           //}
        }
	}
	if(f==0 && j==10)printf("YES");
	else printf("NO");
	return 0;
}


#include<stdio.h>
#include<string.h>
char A[101],B[] = "CODEFORCES",src[101],dest[11];
int main(){
	scanf("%s",A);
	int l=strlen(A),i,f=0,j=0,k,g=0,h;
	for(i=0;i<l;i++){
        if(A[i]!=B[j])f=1;
        else {
            j++;
            if(j==10){
                printf("YES");
                return 0;
            }
        if(f==1){
            //strcpy(src,A+i);
            //strcpy(dest,B+j);
            //if(strstr(src,dest)){
                k=j;
                for(i=i;i<l;i++){
                    if(A[i]==B[k]){
                        k++;g=1;
                        if(k==10&&i==l-1){
                            printf("YES");
                            return 0;
                        }
                    }
                    else {
                        if(g==1)k=j;
                        continue;
                    }
                }
                //if(A[h+10-j]=='\0'){
                    //printf("YES");
                    //return 0;
                //}
                //else{
                    //printf("NO");
                    //return 0;
                //}
           //}
        }
	}
	if(f==0 && j==10)printf("YES");
	else printf("NO");
	return 0;
}


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

int main(){
char str[150];
scanf("%s",&str);
char s[10] = {'C','O','D','E','F','O','R','C','E','S'}; // 'C','O','D','E','F','O','R','C','E','S'
int mass[10];
int i;
int q=0;
for(i = 0; i < strlen(str); i++){
if(s[q]==str[i]){q++;}
if(q==9) break;
}
if((q==9)&&(strlen(str)==0)) printf("YES"); else printf("NO");
system("PAUSE");
return 0;
}


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

char a[101];

int main()
{
    #ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

   	int n, k, sch = 0, ans = 0;
   	scanf("%d%d%s", &n, &k, a);

   	a[n] = 'E';

   	for (int i = 0; i <= n; i++)
   	{
   		if (a[i] != a[i - 1])
   		{
   			ans = max(ans, sch);
   			sch = 0;
   		}
   		if (a[i] == 'N') sch++;
   	}

   	if (ans > k)
   	{
   		printf("NO");
   		return 0;
   	}

   	ans = sch = 0;

   	for (int i = 0; i <= n; i++)
   	{
   		if (a[i] != a[i - 1])
   		{
   			ans = max(ans, sch);
   			sch = 0;
   		}
   		if (a[i] == 'N' || a[i] == '?') sch++;
   	}

   	if (ans >= k)
   		printf("YES");
   	else printf("NO");
   	return 0;
}


#include <stdio.h>
#include <windef.h>

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

    char s[n + 1];
    scanf("%s", s);

    char last = '.';
    int cnt = 0, mxN = 0;
    for(int i = 0; i < n; ++i) {
        if(s[i] == last) {
            cnt++;
        } else {
            last = s[i];
            cnt = 1;
        }
        if(last == 'N') {
            mxN = max(mxN, cnt);
        }
    }

    if (mxN <= k) {
        for (int i = 0; i + k <= n; ++i) {
            bool f = true;
            for (int j = i; j < i + k; ++j)
                f &= s[i] != 'Y';

            if (i != 0)
                f &= s[i - 1] != 'N';
            if (i + k != n)
                f &= s[i + k] != 'N';

            if (f) {
                puts("YES");
                return 0;
            }
        }
    }

    puts("NO");
}


#include<stdio.h>
#define Inf 1LL<<61
#define ll long long
#define NewLine cout<<endl
#define fastIO ios::sync_with_stdio(false);cin.tie(0)
#define REP(i,a,b)for(int i=a;i<b;i++)
#define RREP(i,a,b)for(int i=a;i>b;i--)
#define R(i,b) REP(i,0,b)
#define r(b)REP(_,0,b)
#define RR(i,b) RREP(i,b,-1)
#define R1(i,b) REP(i,1,b)
#define pb push_back
#define IN ll k,q;cin>>k>>q;cin.get()
#define CInt(x)cin>>x;cin.get()
#define CBuff(x)cin.getline(x, sizeof(x))
#define Outl(x)cout << x << '\n'
#define all(x) begin(x),end(x)
using namespace std;

int n, k;
char b[110];
int N[110], m = 0;
int main()
{
	scanf("%d%d", &n, &k);
	scanf("%s", &b);int l = 0;
	R(i, n) {
		if (b[i] == 'N') {
			l++;
		}
		else {
			if (l > 0)
				N[m++] = l;l = 0;
		}
	}l = 0;
	R(i, n) {
		if (b[i] == 'N'|| b[i] == '?') {
			l++;
		}
		else {
			if (l > 0)
				N[m++] = l;l = 0;
		}
	}int u = 0, d = 0;
	R(i, m) {
		if (N[i] >= k)u = 1;
		if (N[i] <= k)d = 1;
	}if (u&&d)printf("YES");else printf("NO");


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

# define F first
# define S second
# define mp make_pair
# define pii pair<int,int>

# define long long long
# define pb push_back
# define sz(a) (int)(a.size())

# define y1     tipa_y1
# define left   tipa_left
# define right  tipa_right

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long MXLL = 4611686018427387903;
const int Sz = 1110111;

int n, k;

char a[11011];

int len = 0, mx = 0;

int main()
{
  scanf ("%d %d", &n, &k);
  for (int i = 1;i <= n;i ++) {
    scanf (" %c", &a[i]);
    if (a[i] == 'N')
      len ++;
    else
    {
      len = 0;
    }
    if (mx < len)
      mx = len;
  }
  if (mx > k)
    printf ("NO");
  else
  {
    len = 0;
    bool ok = 0;
    for (int i = 1;i + k - 1 <= n;i ++) {
      if (i == 1 || a[i - 1] != 'N') {
        bool y = 1;
        for (int j = i;j <= i + k - 1;j ++) {
          if (a[j] == 'Y')
            y = 0;
        }
        if (i + k <= n && a[i + k] == 'N')
          y = 0;
        if (y)
        {
          ok = 1;
          break;
        }
      }
    }
    if (ok)
      printf ("YES");
    else
      printf ("NO");
  }

  return 0;
}

// Coded by Z...


#include<stdio.h>
int main()
{
    long long int n,a,b,i,j,f=0;
    scanf("%lld %lld %lld",&n,&a,&b);
    if(n%a==0)
    {
        printf("YES\n");
        printf("%lld\n",n/a);
        printf("0\n");
        f=1
    }
    if(n%b==0 && n%a!=0)
    {
    printf("YES\n");
    printf("0\n");
    printf("%lld\n",n/b);
    f=1;
    }
    if(n%a!=0 && n%b!=0)
    {
        for(i=1;i<n/a;i++)
        {
            for(j=1;j<n/b;j++)
            {
                if(a*i +b*j==n)
                {
                    printf("YES\n");
                    printf("%lld",i);
                    printf("%lld",j);
                    f=1;
                    break;
                }
            }
        }
    }
    if(f==0)
    printf("NO");
    return 0;
}


#include<stdio.h>
int main()
{
int n,a,b,count=0, remsum ;
scanf("%d",&n);
scanf("%d",&a);
scanf("%d",&b);
remsum = n;
while (remsum >= 0 and remsum%b != 0)
{
	remsum -= a;
	count += 1;
}
if(remsum<0)
printf("NO");
else
printf("YES\n%d % d", count, remsum / b);

return 0;
}


#include <stdio.h>

typedef long long Int;

Int solve(Int n, Int a, Int b) {
  Int x;
  for (x = 0; x <= a; ++x) {
    if (x*a <= n && (n - x*a) % b == 0) {
      puts("YES");
      printf("%I64d %I64d\n", x, (n - x*a) / b);
      return 1;
    }
  }
  return 0;
}

int main() {
  Int n, a, b;
  scanf("%I64d%I64d%I64d", &n, &a, &b);
  if (!solve(n, a, b) && !solve(n, b, a))) {
    puts("NO");
  }
  return 0;
}


#include <stdio.h>

typedef long long Int;

int solve(Int n, Int a, Int b, int f) {
  Int x;
  for (x = 0; x <= a; ++x) {
    if (x*a <= n && (n - x*a) % b == 0) {
      puts("YES");
      if (f) swap(&a, &b);
      printf("%I64d %I64d\n", x, (n - x*a) / b);
      return 1;
    }
  }
  return 0;
}

int main() {
  Int n, a, b;
  scanf("%I64d%I64d%I64d", &n, &a, &b);
  if (!solve(n, a, b, 0) && !solve(n, b, a, 1)) {
    puts("NO");
  }
  return 0;
}


#include<stdio.h>
typedef long long ll;
int main()
{
    ll a,b,n;
    ll c;
    int flag;
    while(scanf("%I64d%I64d%I64d",&n,&a,&b)!=EOF)
    {
        flag=0;
        for(c=0;c<=10000000;c++)
        {
            if(c%a==0 && (n-c)%b==0 && n-c=>0)
            {
                flag=1;
                break;
            }
        }
        if(flag)
        {
            printf("YES\n");
            printf("%I64d %I64d\n",c/a,(n-c)/b);
        }
        else
            printf("NO\n");

    }
    return 0;
}


#include<stdio.h>

bool compare(int n1[],int n2[],int L){
	int i;
	for(i=0;i<L;i++);
		if (n1[i]!=n2[i])
			return false;
	return true;
}

void shift(int n2[],int L){
	int last,i;

	last=n2[L-1];

	for(i=L-1;i>0;i--){
	//	printf("i=%d",i);
		n2[i]=n2[i-1];
	}
	n2[0]=last;
}

main(){
	int c=0,i;
	int n1[50],n2[50],L,n;
//	int	n1[3]={2,4,6},n2[3]={1,5,7},n=3,L=8;
	scanf("%d %d",&n,&L);
	for(i=0;i<n;i++){
		scanf("%d",&n1[i]);
	}

	for(i=0;i<n;i++){
		scanf("%d",&n2[i]);
	}

	while ((compare(n1,n2,L)==false)
				&& (c++<L))
				{
		shift(n2,L);
		//	printf("pOST-shift");
			}
	if (c==L) printf("NO");
	else printf("YES");

	//as long as its not the same or if we got back to same pos
}


#include<stdio.h>
int a[60], b[60];
int n, l;

void arrange(){
	int x1, y1, x2, y2;
	x1 = a[n-1], y1 = a[0];
	x2 = b[n-1], y2 = b[0];
	for(int i=0; i<n-1; i++){
		a[i] = a[i+1] - a[i];
	}
	a[n-1] = l+y1-x1;
	for(int i=0; i<n-1; i++){
		b[i] = b[i+1] - b[i];
	}

	b[n-1] = l+y2-x2;

}

bool checker(int i){
	int j;
	for(j = 0; j<n; j++){
		if(a[j] == b[(i)%n]){
			i++;
			continue;
		}
		else return false;
	}
	return true;

}

bool prime(){
	for(int i=0; i<n; i++){
		if(checker(i) == false) continue;
		else return true;
	}
	return false;

}

int main(){
	int i;
	scanf("%d %d", &n, &l);
	for(i=0; i<n; i++)	scanf("%d", &a[i]);

	for(i=0; i<n; i++)  scanf("%d", &b[i]);

	arrange();

	if(prime() == true) printf("YES\n");
	else printf("NO\n");
	return 0;
}


#include<stdio.h>

bool compare(int n1[],int n2[],int L){
	int i;
	for(i=0;i<L;i++);
		if (n1[i]!=n2[i])
			return false;
	return true;
}

void shift(int n2[],int L){
	int last,i;
	last=n2[L-1];
	for(i=L-1;i>0;i++)
		n2[i]=n2[i-1];
	n2[0]=last;
}

main(){
	int n,L,n1[50],n2[50],c=0,i;
	scanf("%d %d",&n,&L);
	for(i=0;i<n;i++){
		scanf("%d",n1[i]);
	}
	for(i=0;i<n;i++){
		scanf("%d",n2[i]);
	}
	while ((compare(n1,n2,L)==false)
				&& (c++<L))
		shift(n2,L);

	if (c==L) printf("NO");
	else printf("YES");

	//as long as its not the same or if we got back to same pos
}


#include<stdio.h>

int compare(int Q1[],int Q2[],int L){
	int i;
	for(i=0;i<L;i++);
		if (Q1[i]!=Q2[i])
			return 0;
	return 1;
}

void shift(int Q2[],int L){
	int last,i;

	last=Q2[L-1];

	for(i=L;i>=0;i--){
	//	printf("%d\n",i);
		Q2[i]=Q2[i-1];
	}
	Q2[0]=last;
}

main(){
	int c=0,i,barrier;
	int n,L,Q1[100],Q2[100];

	for(i=0;i<L;i++){
		Q1[i]=0;
		Q2[i]=0;
	}

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

	for(i=0;i<n;i++){
		scanf("%d",&barrier);
		Q1[barrier]=1;
	}

	for(i=0;i<n;i++){
		scanf("%d",&barrier);
		Q2[barrier]=1;
	}

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

		if (compare(Q1,Q2,L)==1)
			{
				printf("YES");
				return 0;
			}

		shift(Q2,L);
	}

			printf("NO");

	//as long as its not the same or if we got back to same pos
}


#include<stdio.h>

int main()
{
    int t,m;
    scanf("%d",&t);
    m=t-1;
    int arr[t];
    while(t--)
    {

    int n,k,d,cnt,scnt;
    scanf("%d%d%d",&n,&k,&d);
    arr[t]=d;
    int ar[n];
    for(int i=0;i<n;i++)
    scanf("%d",&ar[i]);
    for(int z=0;z<=n-d;z++)
    {
    cnt=0;
    for(int i=z;i<=z+d;i++)
    {
    if(ar[i]!=0)
    {
    cnt++;
    scnt=1;
    for(int j=i+1;scnt!=d;j++)
    {
    if(ar[i]==ar[j])
    ar[j]=0;
    scnt++;
    }
    }
    }
    if(cnt<arr[t])
    arr[t]=cnt;
    }
    }
    for(int i=m;i>=0;i--)
    printf("%d\n",arr[i]);
    return 0;
}


#include <stdio.h>

int isInside(int *a,int b,int num){

}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    if(d==n){
        printf("%i",d);
        continue;
    }
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}


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

int isInside(int *a,int b,int num){
    int i=0;
    for(i=0;i<b;i++){
        if(num==a[i])
            return 1;
    }
    return 0;
}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){

    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];
            if(!isInside(t,count,tab[i])){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}


#include <stdio.h>

int isInside(int *a,int b,int num){

}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    if(d==n){
        printf("%i\n",d);
        continue;
    }
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}


#include <stdio.h>

int main(void) {
    int x, ans;

    scanf("%d", &x);

    switch (x) {
    case 1:
        ans = 1;    // ok
        break;
    case 2:
        ans = 0;    // ok
        break;
    case 3:
        ans = 0;    // ok
        break;
    case 4:
        ans = 0;
        break;
    case 5:
        ans = 0;    // ok
        break;
    case 6:
        ans = 0;
        break;
    case 7:
        ans = 0;    // ok
        break;
    case 8:
        ans = 1;    // ok
        break;
    case 9:
        ans = 1;    // ok
        break;
    case 10:
        ans = 1;    // ok
        break;
    case 11:
        ans = 0;
        break;
    case 12:
        ans = 0;
        break;
    case 13:
        ans = 1;    // ok
        break;
    case 14:
        ans = 0;
        break;
    case 15:
        ans = 0;
        break;
    case 16:
        ans = 0;
        break;
    }

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

    return 0;
}


#include "stdio.h"
#include "string.h"

int n, cnt;
char s[207];

int main(){
	while(scanf("%d", &n)){
		scanf("%s", s + 1);
		cnt = 0;
		int i, j, k;
		for(i = 1; i <= n; i++){
			for(j = i + 1; j <= n; j++){
				int x = 0, y = 0;
				for(k = i; k <= j; k++){
					if( s[k] == 'L' ) --x;
					else if( s[k] == 'R' ) ++x;
					else if( s[k] == 'D' ) ++y;
					else --y;
				}
				if( x == 0 && y == 0 ) ++cnt;
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
int main(int argc,char** argv){
	int numberofcommand;
	char sourcecode[120];
	long long unsigned int result=0;
	long long unsigned int counter=0;
	//int skip[120];
	//int counterofskip=0;

	//skip[0]=-1;
	scanf("%d",&numberofcommand);
	scanf("%s",sourcecode);
	for(int i=0;i<numberofcommand;i++){
		/*if(i==skip[counter]){
			counter++;
			continue;
		}*/
		int numofR=0;
		int numofL=0;
		int numofU=0;
		int numofD=0;
		for(int j=i;j<numberofcommand;j++){

			switch(sourcecode[j]){
				case 'R': numofR++;break;
				case 'L': numofL++;break;
				case 'U': numofU++;break;
				case 'D': numofD++;break;
				default:break;
			}
			if(numofD==numofU&&numofL==numofR){
				result++;
				//skip[counterofskip++]=j+1;
			}
		}
	}
	printf("%I64d",result);
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
int main(int argc,char** argv){
	int numberofcommand;
	char sourcecode[120];
	long long unsigned int result=0;
	long long unsigned int counter=0;
	//int skip[120];
	//int counterofskip=0;

	//skip[0]=-1;
	scanf("%d",&numberofcommand);
	scanf("%s",sourcecode);
	for(int i=0;i<numberofcommand;i++){
		/*if(i==skip[counter]){
			counter++;
			continue;
		}*/
		int numofR=0;
		int numofL=0;
		int numofU=0;
		int numofD=0;
		for(int j=i;j<numberofcommand;j++){

			switch(sourcecode[j]){
				case 'R': numofR++;break;
				case 'L': numofL++;break;
				case 'U': numofU++;break;
				case 'D': numofD++;break;

			}
			if(numofD==numofU&&numofL==numofR){
				result++;
				//skip[counterofskip++]=j+1;
			}
		}
	}
	printf("%I64d",result);
	return 0;
}


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

int main()
{
	__int64 d1,d2,d3;
	while(~scanf("%I64d%I64d%I64d",&d1,&d2,&d3))
	{
		int ans1 = d1+d2+d3;
		int ans2 = d1*2+d2*2;
		int ans3 = 2*(d1+d3);
		int ans4 = 2*(d2+d3);
		int ans = min(min(ans1,ans2),min(ans3,ans4));
		printf("%I64d\n",ans);
	}
	return 0;
}


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

#include <stdio.h>

int amigos = 5;

int main(){
int arr[amigos] = {};
int acq, a, b, i=0;

scanf("%i", &acq);

do {
	scanf("%i %i", &a, &b);
    arr[a-1]++;
    arr[b-1]++;
	i++;
} while (i < acq);

for(int i = 0; i<amigos; i++){
    if(arr[i] != 2){
        printf("WIN");
        return 0;
    }
}
printf("FAIL");

return 0;
}


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

unsigned int return_torre(int r1, int c1, int r2, int c2){
	//Si estan en la misma columna o fila solo necesita un movimiento
	if((r1 == r2) || (c1 == c2)){
		return 1;
	}
	//Si no son 2
	else{
		return 2;
	}
}

unsigned int return_alfil(int r1, int c1, int r2, int c2){
	//Para checar si está en el mismo color solo se compara el mod de las restas
	//Si esta en diferente color no hay manera de llegar
	if ((r1 + c1) % 2 != (r2 + c2) % 2){
		return 0;
	}
	// Si está en el cuadrante solo necesita un movimiento
	if((abs(r2 - r1)) == (abs(c2 - c1))){
		return 1;
	}
	//Sino son 2 movimientos
	else{
		return 2;
	}

}

unsigned int return_rey(int r1, int c1, int r2, int c2){
	//Si esta en la misma fila solo se mueve la diferencia de las columnas
	if(r2 == r1){
		return (abs(c2-c1));
	}
	//Si esta en la misma columna, se mueve la diferencia de las filas
	if(c2 == c1){
		return (abs(r2-r1));
	}
	//sino el numero maximo de las diferencias
	else{
		return (max((abs(r2-r1)), (abs(c2-c1))));
	}
}

int main() {
	int r1 = 0, r2 = 0, c1 = 0, c2 = 0;
	cin >> r1 >> c1 >> r2 >> c2;
	unsigned int torre = 0, alfil = 0, rey = 0;

	torre = return_torre(r1, c1, r2, c2);
	alfil = return_alfil(r1, c1, r2, c2);
	rey = return_rey(r1, c1, r2, c2);

	cout << torre <<" " << alfil << " " << rey;
}


#include <stdio.h>

int main()
{
		int a[5][5] = {};

		int m;
		scanf("%d", &m);
		while(m-->0)
		{
			int i, j;
			scanf("%d%d", &i, &j);
			--i;
			--j;
			a[i][j] = a[j][i] = 1;
		}

		bool win = false;
		for (int i = 0; i < 5; ++i)
			for (int j = 0; j < i; ++j)
				for (int k = 0; k < j; ++k)
					if (a[i][j] == 1 && a[j][k] == 1 && a[k][i] == 1 || a[i][j] == 0 && a[j][k] == 0 && a[k][i] == 0)
					{
						win = true;
						goto end;
					}
		end:
		if (win)
			puts("WIN\n");
		else
			puts("FAIL\n");

		return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[105];
	int t[105]={0};
	int ans=0;
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=0;i<n;i++)
	{
		//cin>>a[i];
		if(a[i]==0)
		ans++;
		if(a[i]==3&&i!=0)
		{
			if(a[i-1]==1)
			a[i]=2;
			else if(a[i-1]==2)
			a[i]=1;
		}
		if(a[i]==a[i-1]&&a[i]==1)
		{
			 a[i]=0;
			 ans++;
		}
		if(a[i]==a[i-1]&&a[i]==2)
		{
			 a[i]=0;
			 ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

#define C 1
#define G 2

/**
	{@param arr}
*/

int min_rest_days(int *arr, int n, int i, int last, int rest) {
	int rest1, rest2;

	for(; i < n; ++i) {
		if (arr[i] == 1 && last != 1) last = 1;
		else if (arr[i] == 2 && last != 2) last = 2;
		else if (arr[i] == 3) {
			if (last != 0) {
				if (last == 1) last = 2;
				else last = 1;
			} else {
                rest1 = min_rest_days(arr, n, i, 1, rest);
                rest2 = min_rest_days(arr, n, i, 2, rest);

                if (rest1 < rest2) return rest1;
                else return rest2;
			}
		} else {
			++rest;
			last = 0;
		}
	}

	return rest;
}

int main()
{
    int i, min = 0, n;
    int arr[101];
    //FILE *fp = fopen("E:\\Codeblocks\\in\\inp.txt", "r");

    //if(!fp) exit(0);

    //fscanf(fp, "%d", &n);
    scanf("%d", &n);

    for(i = 0; i < n; i++) {
        //fscanf(fp, "%d", arr+i);
        scanf("%d", arr+i);
    }

    min = min_rest_days(arr, n, 0, 0, 0);

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

    return 0;
}


#include<studio.h>

int main()
{
   int a;

   printf("enter the number u wanna split:  ");

   scanf("%d" &a);

   printf("%d", (a/2)+1);

   return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="ars" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/ars" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/ars" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
		<Unit filename="main.c">
			<Option compilerVar="CC" />
		</Unit>
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include<stdio.h>

int main()
{
    int n ;

    scanf("%d", &n);

    printf("%d\n", (n/2 +1));

    return 0;


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin>>n;
	n=n/2+1;
	cout<<n<<endl;
return 0;
 }


#include<stdio.h>

int main(void)
{
int num;
scanf("%d",&num);
printf("%d\n",n/+1);
return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int t,s,a;
int tab[45];
scanf("%d",&t);
for (int i=0;i<t;i++){
     scanf("%d",&s);
     a=0;
     if(s>9){
     for(int j=0;j<10;j++){
        s=s-(9-j);
        if(s>0){
            a=a+(9-j)*pow(10,j);}
            printf(a);
        else  {
            s=s+(9-j);
            a=a+abs(s)*pow(10,j);
        break;}
                         }
     tab[i]=a;
             }
    else{
        tab[i]=s;
        }
                     }
    for (int i=0;i<t;i++){
            printf("%d \n",tab[i]);}
}


#include <stdio.h>
int recursion(int in,int Minus) {

	if (in - Minus > 0) {
		in -= Minus;
		Minus--;
		recursion(in, Minus);
	}
	else {
		printf("%d", in);
		return ++Minus;
	}
}
int main() {
	int loop,in;
	scanf("%d", &loop);
	while (loop--) {
		scanf("%d", &in);
		int Minus = recursion(input, 9);
		for (;Minus <= 9;Minus++)
			printf("%d", Minus);
		printf("\n");
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
int main() {
    int t;
    scanf_s("%d", &t);
    while (t--) {
        int n, s = 0, j = 1;;
        scanf_s("%d", &n);
        for (int i = 9;i > 0;i--) {
            if (n >= i) {
                n -= i;
                s += (i * j);
                j *= 10;
            }
        }
        printf("%d\n", s);
    }
    return 0;
}


#include <stdio.h>

int main(){
    int x, y, z, a, b, c;
    scanf("%d %d %d\n%d %d %d", &x, &y, &z, &a, &b, &c);
    int temp = 0;
    if(a <= x){
        goto fail;
    }
    temp = a - x;
    if(temp + b <= y){
        goto fail;
    }
    temp = temp + b - y;
    if(temp + c <= z {
        goto fail;
    })
    printf("YES");
    return;
fail:
    printf("NO");
    return;
}


#include <stdio.h>

int main(){
    int x, y, z, a, b, c;
    scanf("%d %d %d\n%d %d %d", &x, &y, &z, &a, &b, &c);
    int temp = 0;
    if(a <= x){
        goto fail;
    }
    temp = a - x;
    if(temp + b <= y){
        goto fail;
    }
    temp = temp + b - y;
    if(temp + c <= z) {
        goto fail;
    })
    printf("YES");
    return;
fail:
    printf("NO");
    return;
}


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

int main()
{
    int x,y,z,a,b,c;
    scanf("%d%d%d%d%d",&x,&y,&z,&a,&b,&c);
    if(x<=a && y<=a-x+b && z<=(a+b+c-x-y) printf("YES");
    else printf("NO");
    return 0;
}


Last login: Thu Feb  7 20:59:14 on console
➜  ~ gcc xorney.c
clang: error: no such file or directory: 'xorney.c'
clang: error: no input files
➜  ~ cd Desktop
➜  Desktop cd codes
➜  codes gcc xorney.c
➜  codes ./a.out
13X357-22
invalid%                                                                        ➜  codes
  [Restored 12-Feb-2019 at 9:07:47 PM]
Last login: Sun Feb 10 23:36:43 on ttys000
➜  codes gcc Projecteuler1.c
➜  codes ./a.out
234168%                                                                         ➜  codes gcc Projecteuler1.c
➜  codes ./a.out
234168%                                                                         ➜  codes gcc Projecteuler1.c
➜  codes ./a.out
234168%                                                                         ➜  codes gcc Projecteuler1.c
➜  codes ./a.out
33
➜  codes gcc Projecteuler1.c
➜  codes ./a.out
33
➜  codes gcc Projecteuler1.c
➜  codes ./a.out
33
➜  codes gcc Projecteuler1.c
Projecteuler1.c:9:4: error: use of undeclared identifier 'sum1'
                        sum1 += i;
                        ^
Projecteuler1.c:15:23: error: use of undeclared identifier 'sum1'
        printf("%d\n", sum + sum1 - sum2);
                             ^
2 errors generated.
➜  codes gcc Projecteuler1.c
➜  codes ./a.out
33
➜  codes gcc Projecteuler1.c
➜  codes ./a.out
23
➜  codes gcc Projecteuler1.c
➜  codes ./a.out
233168
➜  codes vi grapes.c
➜  codes ./a.out
233168
➜  codes gcc grapes.c
grapes.c:2:1: warning: variable named 'main' with external linkage has undefined
      behavior [-Wmain]
int main{
^
grapes.c:2:9: error: expected ';' after top level declarator
int main{
        ^
        ;
1 warning and 1 error generated.
➜  codes vi grapes.c
➜  codes gcc grapes.c
grapes.c:2:1: warning: variable named 'main' with external linkage has undefined
      behavior [-Wmain]
int main{
^
grapes.c:2:9: error: expected ';' after top level declarator
int main{
        ^
        ;
1 warning and 1 error generated.
➜  codes ./a.out
233168
➜  codes vi grapes.c
➜  codes gcc grapes.c
➜  codes ./a.out
1 6 2
4 3 3
NO
➜  codes vi grapes.c
➜  codes gcc grapes.c
➜  codes ./a.out
1 6 2
4 3 3
YES
➜  codes ./a.out
5 1 1
4 3 2
NO
➜  codes vi grapes.c

#include<stdio.h>
int main(){
    int x, y, z, a, b, c, i, j , k;
    scanf("%d%d%d%d%d%d", &x, &y, &z, &a, &b, &c);
    if(a + b + c >= x + y + z){
        if(a - x < 0)
            printf("NO\n");
        else{
            i = x - a;
            if(b - i + y < 0)
                printf("NO\n");
            else{
                j = i + y - b;
                if(c - j + z < 0)
                    printf("NO\n");
                else
                printf("YES\n");
}
}
}
else
printf("NO\n");
}


#include<stdio.h>

typedef long long int l_int;

int answer(l_int bx,l_int by,l_int cx,l_int cy);

int main(void){
  struct vector{
    l_int x;
    l_int y;
  }a,b,c,d;
  int flg,j,k;

  scanf("%lld %lld",&a.x,&a.y);
  scanf("%lld %lld",&b.x,&b.y);
  scanf("%lld %lld",&c.x,&c.y);

  flg=0;
  flg+=answer(b.x-a.x,b.y-a.y,c.x,c.y);
  flg+=answer(b.x+a.y,b.y-a.x,c.x,c.y);
  flg+=answer(b.x+a.x,b.y+a.y,c.x,c.y);
  flg+=answer(b.x-a.y,b.y+a.x,c.x,c.y);

  if(flg==0) puts("NO");
  else puts("YES");
  return 0;
}

int answer(l_int bx,l_int by,l_int cx,l_int cy){
  l_int tmp;
  if(cx==0 && cy==0){
    if(bx==0 && by==0) return 1;
    return 0;
  }
  if(cx==0){
    if(bx%cy==0 && by%cy==0) return 1;
    return 0;
  }else if(cy==0){
    if(bx%cx==0 && by%cx==0) return 1;
    return 0;
  }else{
    tmp=cx*cx+cy*cy;
    if((bx*cx+by*cy)%tmp==0 && (by*cx-bx*cy)%tmp==0) return 1;
    return 0;
  }
  return 0;
}


#include<stdio.h>

int answer(long long int  bx,long long int  by,long long int  cx,long long int  cy);

int main(void){
  struct vector{
    long long int  x;
    long long int  y;
  }a,b,c,d;
  int flg,j,k;

  scanf("%l64d %l64d",&a.x,&a.y);
  scanf("%l64d %l64d",&b.x,&b.y);
  scanf("%l64d %l64d",&c.x,&c.y);

  flg=0;
  flg+=answer(b.x-a.x,b.y-a.y,c.x,c.y);
  flg+=answer(b.x+a.y,b.y-a.x,c.x,c.y);
  flg+=answer(b.x+a.x,b.y+a.y,c.x,c.y);
  flg+=answer(b.x-a.y,b.y+a.x,c.x,c.y);

  if(flg==0) puts("NO");
  else puts("YES");
  return 0;
}

int answer(long long int  bx,long long int  by,long long int  cx,long long int  cy){
  long long int  tmp;
  if(cx==0 && cy==0){
    if(bx==0 && by==0) return 1;
    return 0;
  }
  if(cx==0){
    if(bx%cy==0 && by%cy==0) return 1;
    return 0;
  }else if(cy==0){
    if(bx%cx==0 && by%cx==0) return 1;
    return 0;
  }else{
    tmp=cx*cx+cy*cy;
    if((bx*cx+by*cy)%tmp==0 && (by*cx-bx*cy)%tmp==0) return 1;
    return 0;
  }
  return 0;
}


#include<stdio.h>

int answer(int bx,int by,int cx,int cy);

int main(void){
  struct vector{
    int x;
    int y;
  }a,b,c,d;
  int flg,j,k;

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

  flg=0;
  flg+=answer(b.x-a.x,b.y-a.y,c.x,c.y);
  flg+=answer(b.x+a.y,b.y-a.x,c.x,c.y);
  flg+=answer(b.x+a.x,b.y+a.y,c.x,c.y);
  flg+=answer(b.x-a.y,b.y+a.x,c.x,c.y);

  if(flg==0) puts("NO");
  else puts("YES");
  return 0;
}

int answer(int bx,int by,int cx,int cy){
  int tmp;
  if(cx==0 && cy==0){
    if(bx==0 && by==0) return 1;
    return 0;
  }
  if(cx==0){
    if(bx%cy==0 && by%cy==0) return 1;
    return 0;
  }else if(cy==0){
    if(bx%cx==0 && by%cx==0) return 1;
    return 0;
  }else{
    tmp=cx*cx+cy*cy;
    if((bx%tmp*cx%tmp+by%tmp*cy%tmp)%tmp==0 && (by%tmp*cx%tmp-bx%tmp*cy%tmp)%tmp==0) return 1;
    return 0;
  }
  return 0;
}


#include<stdio.h>

typedef long long int l_int;

int answer(int bx,int by,int cx,int cy);

int main(void){
  struct vector{
    l_int x;
    l_int y;
  }a,b,c,d;
  int flg,j,k;

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

  flg=0;
  flg+=answer(b.x-a.x,b.y-a.y,c.x,c.y);
  flg+=answer(b.x+a.y,b.y-a.x,c.x,c.y);
  flg+=answer(b.x+a.x,b.y+a.y,c.x,c.y);
  flg+=answer(b.x-a.y,b.y+a.x,c.x,c.y);

  if(flg==0) puts("NO");
  else puts("YES");
  return 0;
}

int answer(l_int bx,l_int by,l_int cx,l_int cy){
  l_int tmp;
  if(cx==0 && cy==0){
    if(bx==0 && by==0) return 1;
    return 0;
  }
  if(cx==0){
    if(bx%cy==0 && by%cy==0) return 1;
    return 0;
  }else if(cy==0){
    if(bx%cx==0 && by%cx==0) return 1;
    return 0;
  }else{
    tmp=cx*cx+cy*cy;
    if((bx*cx+by*cy)%tmp==0 && (by*cx-bx*cy)%tmp==0) return 1;
    return 0;
  }
  return 0;
}


#include<bits/stdc++.h>

using namespace std;
int main()
{
	long int n,m;
	int a,b;

	cin>>n>>m>>a>>b;

	long int r1,r2,c1,c2;

	if(n%m==0)
	{
		cout<<0<<endl;
	}

	else
	{
		r1=n%m;
		r2=m-r1;

		c1=r1*b;
		c2=r2*a;

		if(c1<c2)
		cout<<c1<<endl;

		else
		cout<<c2<<endl;
	}
	return 0;

}


#include <cstdio>

int main()
{
    int a,b,c,d,e;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    e=a%b;
    printf("%d",e*d<(b-e)*c ? e*d : (b-e)*c);
    return 0;
}


#inlude<stdio.h>
int maiN()
{
    int n,m,a,b;
    while(scanf("%d%d%d%d",&n,&m,&a,&b)!=EOF)
    {
        int k=n%m;
        int l=m-k;
        if(k*b>l*a)
            printf("%d",l*a);
        else
            printf("%d",k*b);
    }
    return 0;
}


#include<stdio.h>
long long int
int main()
{
    scanf("%lld",&t);
    for(i=0;i<t;i++)
    {
        scanf("%lld %lld %lld %lld %lld %lld",&x,&y,&z,&a,&b,&c);
        if(x<=y && x<=z)
        {
            min=x;
        }
        else if(y<=x && y<=z)
        {
            min=y;
        }
        else if(z<=x && z<=y)
        {
            min=z;
        }
        else if(x<=y && x>=z || x>=y && x<=z)
        {
            mid=x;
        }
        else if(y<=x && y>=z || y>=x && y<=z)
        {
            mid=y;
        }
        else if(z<=x && z>=y || z>=x && z<=y)
        {
            mid=z;
        }
        else if(z>=x && z>=y)
        {
            max=z;
        }
        else if(x>=y && x>=z)
        {
            max=x;
        }
        else if(y>=x && y>=z)
        {
            max=y;
        }

        d=3*a;
        e=(b/2)*3;
        f=c;
        if(d<=e && d<=f)
        {
            ans=x+y+z;
        }
        else if(e<=d && e<=f)
        {
            if(d<=f)
            {
                if((min+mid)==max)
                {
                    ans=(min+mid)*b;
                }
                else if((min+mid)>max)
                {
                    ans=((((min+mid+max)/2)*b)+((min+mid+max)%2)*a);
                }
                else if((min+mid)<max)
                {
                    ans=((min+mid)*b)+((max-(min+mid))*a);
                }
            }
        }
    }
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int m,n,a,b,diff,cost;
    scanf("%d%d%d%d",&n,&m,&a,&b);
    diff=(n-m)>0:n-m:m-n;
    printf("%d",diff);
    cost=diff*a <diff*b?diff*a :diff*b;
    printf("%d",cost);
    return 0;
}


#include<stdio.h>
int main()
{
	__int64 n,i,count=0;
	scanf("%I64d",&n);
	for(i=1;i<=(n/4);i++)
	{
		if(i!=(n-2*i)/2)
			count+=1;
		else
			count=count;
	}
	printf("%I64d",count);
	return 0;


#include <stdio.h>
#include <stdlib.h>
int main()
{
	int n;
	scanf("%d",&n);
	if(n%4==0)
	{
		printf("%d\n",(n-4)/4);
	}
	else if(n%2==0)
	{
		printf("%d\n",(n-2)/4);
	}
	else
	{
		printf("0\n");
	return 0;
}


#include<bits/stdc++.h>
int main()
{
    int n,m;
    scanf("%d",&n);
    if(n%4==0)
        {
        m=-1;
        }
    else
        m=0;
    if(n%2)
    {
        printf("0\n");
        return 0;
    }
    else{
        m+=n/4;
    }
    printf("%d\n",m);
    return 0;
}


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

using namespace std;
int main()
{
    int long long  n;
    int long long aux;

    cin>> n;
    if(n%2==1)
        printf("0\n");

    cout<<(n/2-1)/2<<endl;

    return 0;

}


#include <stdio.h>

longint X, Y, d, digit, b;
int n, i;
int main() {
	scanf("%d %d", &n, &b);
	d = 1;
	for(i=1; i<n; i++) d *= b;
	for(i=0; i<n; i++) {
		scanf("%d", &digit);
		X += digit*d;
		d /= b;
	}

	scanf("%d %d", &n, &b);
	d = 1;
	for(i=1; i<n; i++) d *= b;
	for(i=0; i<n; i++) {
		scanf("%d", &digit);
		Y += digit*d;
		d /= b;
	}
	if(X<Y)
		printf("<");
	else if (X>Y)
		printf(">");
	else
		printf("=");
	return 0;
}


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

	scanf("%d%d",&nd1,&bas1)
	for (i = 0; i< nd1; i++){
		scanf("%d", num1[i]);
		res1 = res1 + num1[i]*(pow(bas1,nd1-1-i);
		}
	scanf("%d%d",&nd2,&bas2);
	for (i = 0; i<nd2; i++){
		sacnf("%d",&num2[i]);
		res2 = res2 + num2[i]*(pow(bas2,nd2-1-i);
		}
	if(res1<res2){
		printf("<")
		}
	if(res1>res2){
		printf(">")
		}
	else{
		printf("=")
		}
}


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

using namespace std;

long long power(int a, int b);

int main(void)
{
    int *xx, *yy;
    int n, m, bx, by, i;
    long long x, y;
    x = y = 0;
    scanf("%d %d", &n, &bx);
    xx = (int *)malloc(n*sizeof(int));
    for (i = n-1; i>-1; i--) scanf("%d", &xx[i]);
    scanf("%d %d", &m, &by);
    for (i = 0; i<n; i++) x += xx[i]*power(bx, i);
    yy = (int *)malloc(m*sizeof(int));
    for (i = m-1; i>-1; i--) scanf("%d", &yy[i]);
    for (i = 0; i<m; i++) y += yy[i]*power(by, i);
    if (x<y) {printf("<"); return 0;}
    if (x>y) {printf(">"); return 0;}
    if (x==y) {printf("="); return 0;}
}

long long power(int a, int b)
{
    int i;
    long long p;
    for (p = 1, i = 1; i<=b; i++)
        p *= a;
    return p;
}


#include<stdio.h>
double input()
{
    double input()
double n,x,y;
double sum=0;
scanf("%lf %lf",&n,&x);
while(n--)
{
    scanf("%lf",&y);
    sum=sum*x+y;
}
return sum;
}
int main(){
    double a,b;
    a=input();
    b=input();
    if(a>b)
        puts(">");
    else if(a==b)
        puts("=");
    else puts("<";)
}


#include <stdio.h>
int main()
{
	int i,j,temp;
	int s[4];
	for (int i = 0; i < 4; ++i)
	{
		scanf("%d",&s[i]);
	}
	for (int i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 3-i; ++j)
		{
			if (s[j]>s[j+1])
			{
				temp=s[j];
				s[j]=s[j+1];
				s[j+1]=temp;
			}
		}
	}
	if (s[1]+s[2]==s[0]+s[3])
	{
		print("yes");
	}
	else
		printf("no");
	return 0;

}


#include<stdio.h>
int main()
{
int a,b,c,d,n;
printf("enter the no of bags");
scanf("%d",&n);
printf("enter the candies no");
scanf("%d%d%d%d",&a,&b,&c,&d);
if(a+b==c+d)&&(a+c==b+d)&&(a+d==b+c)&&(a+b+c==d)&&(a+b+d==c)&&(b+c+d==a)&&(c+d+a==b)
{
printf("YES");
}
else
{
printf("NO");
}
return 0;
}


#include <std.io>

int main(){
    int a[4];
    for(int i=0;i<4;i++)
    scanf("%d",&a[i]);

    for(int i=0;i<4;i++)
{
    for(int j=i;j<4;j++)
    {
        if(a[i]>a[j]){
        int t=a[i];
        a[i]=a[j];
        a[j]=t;
        }
    }
}

int s1=a[0]+a[3];
int s2=a[1]+a[2];
if(s1==s2)
printf("YES");
else
printf("NO");

    return 0;

}


#include <stdio.h>

void func(int tot);

int main(void){
    int i, tot = 0;
    int arr[4];
    for(i=0;i<4;i++){
        scanf(" %d",arr+i);
    }

    for(i=0;i<4;i++)
      tot+= arr[i];

    func(tot);

    return 0;
}

void func(int tot){
    int i,k,sum;

    for(i=0;i<4;i++){
        if(arr[i] == 2*tot){
          printf("YES")
          return;
        }
    }

    for(i=0;i<4;i++){
        sum = 0
        for(k=i+1;k<4;k++){
          sum = arr[i]+arr[k]
        if(sum == 2*tot){
          printf("YES")
          return;
        }
        }
    }

    printf("NO")

}


#include<stdio.h>
#include<math.h>
int main()
{
	int n,k;
	char s[105];
	int target,grass;
	scanf("%d%d",&n,&k);
	int flag=0;X
	for(int i=1;i<=n;i++)
	{
		scanf("%c",&s[i]);
		if(s[i]=='T') target=i;
		if(s[i]=='G') grass=i;
	}
	if(grass<target)
	{
		int j=grass;
		while(s[j]!='#'&&j<target)
		{
			j+=k;
			if(s[j]=='T') flag=1;
		}
	}
	if(grass>target)
	{
		int j=grass;
		while(s[j]!='#'&&j<target)
		{
			j-=k;
			if(s[j]=='T') flag=1;
		}
	}
	if(flag==1) printf("YES\n");
	else printf("NO\n");
	return 0;
}


#include<stdio.h>
#include<string.h>
main()
{
	int n,k,l,i,m,j;
	scanf("%d%d",&n,&m);
	char s[n+1];
	scanf("%s",s);
	l=strlen(s);
	for(i=0;i<l;i++)
	{
		if(s[i]=='G')
		k=i;
		if(s[i]=='T')
		j=i;
	}
	if((k-j)<0)
	{
		i=k;
		while(i<=j)
		{
			if(s[i]=='#')
			{
			printf("NO");
			break;
		    }
			if(i==j)
			{
				printf("YES");
				break;
			}
			i=i+m;
		}
		if(i>j)
		printf("NO");

	}
	if((k-j)>0)


#include<stdio.h>

main{
	int n,k,g,t;
	scanf("%d %d",&n,&k);
	int i;
	char arr[n];

	scanf("\n");
	for(i=0;i<n;i++)
	{

		scanf("%c",&arr[i]);
		if(arr[i]=='G') g=i;

		if(arr[i]=='T') t=i;

	}if(g<t){
			for(i=g; i<=t; i=i+k)
    	{
		if(arr[i]=='#')
		{printf("NO"); return 0;

		}
     	}
	if(i==t+k)
	printf("	YES");
	else printf("NO");
	}

	else

	{
		for(i=t;i<=g;i=i+k)
		{
				if(arr[i]=='#')
				{printf("NO");
				return 0;}
		}

	if(i==g+k)
	printf("YES");
	else printf("NO");
	}

	return 0;
}


#include<stdio.h>
int main()
{
    int n,k;
    int pos1,pos2,temp;
    char s[110];
    scanf("%d%d",&n,&k);
    scanf("%s",s);
    for(int i=0;i<n;i++)
    {
        if(s[i]=='G')
        {
            pos1=i;
        }
        if(s[i]=='T')
        {
            pos2=i;
        }
    }
    if(pos1>pos2)
    {
        temp=pos1;
        pos1=pos2;
        pos2=temp;
    }
    #printf("%d!%d\n",pos1,pos2);
    while(pos1+k<100)
    {
        if(pos1+k==pos2)
        {
            printf("YES\n");
            return 0;
        }
        if(s[pos1+k]=='#')
        {
            printf("NO\n");
            return 0;
        }
        pos1=pos1+k;
    }
    printf("NO\n");
    return 0;
}


#include <cstdio>

char a[101];

int main() {

	unsigned char n, k;
	scanf("%hhu %hhu\n", &n, &k);
	scanf("%s", a);

	unsigned char i;
	for (i = 0; i < n; i++) {
		if (a[i] == 'T' || a[i] == 'G')
			break;
	}

	for (i += k; i < n; i += k) {
		switch (a[i]) {
		case '#':
			printf("NO");
			return 0;
			break;
		case 'G':
		case 'T':
			printf("YES");
			return 0;
			break;
		}
	}

	printf("NO");
	return 0;
}


#include<stdio.h>
#include<conio.h>
int main(){
    long long a;
    int i,j,n=0;
    int c=0
    printf("enter a number 1<a<10^18");
    scanf("%I64d",a);
    for(i=1;i<=a;i++){
        for(j=2;j<=10;j++)
            if(i%j!=0)
                n++;
        if(n==9){
            c++;
            n=0;
        }
    }
    printf("%d",c);
    getch();
    return 0;

}


#include<stdio.h>
 int main(){
 long long inp;
int counter = 0;
 scanf("%I64d",&inp);
for(int i = 1;i<= inp;i++)
 if(i % 2520! = 0 ){ counter = counter + 1; }
} printf("%d",counter);
}


#include <bits/stdc++.h>

using namespace std;

int egcd(int a, int b, int &x, int &y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }

    int x1, y1;
    int gcd = egcd(b % a, a, x1, y1);

    x = y1 - (b / a) * x1;
    y = x1;

    return gcd;
}

int main() {
    int a, b, c, g, x, y;

    cin >> a >> b >> c;

    g = egcd(a, b, x, y);

    if (y < x) {
        swap(x, y);
        swap(a, b);
    }

    if (c % g) {
        cout << "No";
        return 0;
    }

    a /= g;
    b /= g;
    c /= g;

    if (c * y - (-c * x + b - 1) / b * a < 0)
        cout << "No";
    else
        cout << "Yes";

    return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="633/a" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/633/a" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/633/a" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
			<Add option="-fexceptions" />
		</Compiler>
		<Unit filename="main.cpp" />
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include<stdio.h>
#include<iostream>
using namespace std;
int main ()
{
    int x,y,z,i,j,ck=0;
    scanf("%d%d%d",&x,&y,&z);
    for(i=0;i<=z;i++){
        for(j=0;j<=z;j++){
            if(x*i+y*j==z){
                ck=1;
                break;
            }
        }
    }
    if(ck==1){
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}


#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,m=0,j,s=0,i;
clrscr();
scanf("%d%d%d",&a,&b,&c);
for(i=0;i<=999;i++)
for(j=0;j<=999;j++)
{
s=a*i+b*j;
if(s==c)
m=1;
s=0;
}
if(m==1)
printf("Yes");
else
printf("No");
getch();
}


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

int main()
{
    int a , b , c , i , temp;
    scanf("%d %d %d", &a ,&b ,&c);
    for ( i = 1 ; i <= c ; i++){
        temp = c - ( i * a);
        if ( temp >= 0 && temp % b == 0 ){
            print("Yes");
            return 0;
        }
    }
    print("No");
    return 0;
}


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

#define swap(a,b) (a)=(a)+(b)-((b)=(a))
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define FOR(i,a,b) for((i)=(a);(i)<(b);(i)++)
#define pw printf(" ")
#define pn printf("\n")
#define pi(a) printf("%d",(a))
#define si(a) scanf("%d",(&a))
#define FORD(i,a,b) for((i)=(a);(i)>=(b);(i)++)
#define chkpowtwo(a) (!((a)&((a)-1)))

inline int power(int a,int b)
{
	int s=1;
	while(b)
	{
		if(b&1)
			s*=a;
		a=a*a;
		b=b/2;
	}
	return s;
}

int main()
{
	int n;
	si(n);
	int i,flag,x,count=0;
	FOR(x,1,n)
	{
		flag=0;
		FOR(i,1,n-1)
		{
			if(power(x,i)%n==1)
				flag=1;
		}
		if(power(x,n-1)%n!=1)
			flag=1;
		if(flag==0)
			count++;
	}
	pi(count);pn;
	return 0;
}


#include <cstdio>

int main()
{
    int p, count(0);
    scanf("%d", &p);
    for (int n = 1; n < p; ++n)
    {
        bool ok = true;
        int x = 1;
        for (int i = 1; i < p - 1; ++i)
        {
            x *= n;
            x %= p;
            if (x == 1)
            {
                ok = false;
                break;
            }
        }
        if (ok)
        {
            x *= n;
            x %= p;
            if (x == 1)
            {
                count += 1;
            }
        }
    }
    printf("%d\n", count);
    return 0;
}

//4306655	 Aug 18, 2013 8:36:13 AM	fuwutu	 284A - Cows and Primitive Roots	 GNU C++0x	Accepted	30 ms	0 KB
#include <cstdio>

int main()
{
    int p;
    scanf("%d", &p);
    int n = p - 1;
    int count = n;
    for (int i = 2; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            do
            {
                n /= i;
            } while (n % i == 0);
            count = count / i * (i - 1);
        }
    }
    if (n != 1)
    {
        count = count / n * (n - 1);
    }
    printf("%d\n", count);
    return 0;


#include <cstdio.h>

int main()
{
    int p;
    scanf("%d", &p);
    int n = p - 1;
    int count = n;
    for (int i = 2; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            do
            {
                n /= i;
            } while (n % i == 0);
            count = count / i * (i - 1);
        }
    }
    if (n != 1)
    {
        count = count / n * (n - 1);
    }
    printf("%d\n", count);
    return 0;


#include <stdio.h>

int main()
{
    int p;
    scanf("%d", &p);
    int n = p - 1;
    int count = n;
    for (int i = 2; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            do
            {
                n /= i;
            } while (n % i == 0);
            count = count / i * (i - 1);
        }
    }
    if (n != 1)
    {
        count = count / n * (n - 1);
    }
    printf("%d\n", count);
    return 0;


#include<stdio.h>
int main()
{
	int n,m,k,i,j,count,temp,o=0;
	scanf("%d%d%d",&n,&m,&k);
	int a[n];
	for(i=0;i<n;i++)
	scanf("%d",&a[i]);
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i]>a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
	m=m-k;
	temp=0;
	count=0;
	o=0;
	for(i=n-1;i>=0;i--)
	{
		if(temp<m)
		{
			temp=temp+a[i]-1;
			o++;
		}
		else if(temp>=m)
		{
			printf("%d",o);
			count=1;
			break;
		}
	}
	if(count==0)
	printf("-1");
}#include<stdio.h>
int main()
{
	int n,m,k,i,j,count,temp,o=0;
	scanf("%d%d%d",&n,&m,&k);
	int a[n];
	for(i=0;i<n;i++)
	scanf("%d",&a[i]);
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i]>a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
	m=m-k;
	temp=0;
	count=0;
	o=0;
	for(i=n-1;i>=0;i--)
	{
		if(temp<m)
		{
			temp=temp+a[i]-1;
			o++;
		}
		else if(temp>=m)
		{
			printf("%d",o);
			count=1;
			break;
		}
	}
	if(count==0)
	printf("-1");
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="socket" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin\Debug\socket" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj\Debug\" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin\Release\socket" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj\Release\" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
		<Unit filename="main.c">
			<Option compilerVar="CC" />
		</Unit>
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include<stdio.h>
int b[501];
void merge(int a[], int k,int l);
void merge_sort(int a[], int n);

int main()
{
    int n,m,k,i,s,flag,a[501];
    scanf("%d%d%d",&n,&m,&k);
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    merge_sort(a,n);
    s=k;
    i=0;
    flag=0;
    while(s<m&&i<n&&)
    {
              s=s+a[n-1-i]-1;
              i++;
              if(s>=m) {flag=1;break;}
    }
    if(k!=0&&flag) printf("%d\n",i);
    else printf("-1\n");//getch();
    return 0;
}
void merge_sort(int a[], int n)
{
if(n==1||n==0) return;
merge_sort(a, n/2);
merge_sort(a+n/2, n-n/2);
merge(a,n/2, n-n/2);
}

void merge(int a[], int k,int l)
{
 int i,j=k,c=0;
for(i=0;i<k&&j<k+l;)
{
while(a[i]<a[j]&&i<k){ b[c]=a[i]; c++; i++;} if(i==k) break;
while(a[i]>=a[j]&&j<k+l){ b[c]=a[j];c++; j++;} if(j==k+l) break;
}
if(i<k) {for(;i<k;i++){ b[c]=a[i];c++;}}
else if(j<k+l) { for(;j<k+l;j++){ b[c]=a[j];c++;}}

for(i=0;i<k+l;i++)
  a[i]=b[i];
}


#include<stdio.h>
#include<string.h>
int main()
{
	char a[200];
	int count = 0;
	gets(a);
	int n = strlen(a);
	for(int i = 0; i < n; i++)
	if( a[i] == 'Q');
	for(int j = i + 1; j < n; j++)
	if( a[j] == 'A');
	for(int k = j + 1; k < n; k++)
	if( a[k] == 'Q');

	count++;

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


#include<stdio.h>
#include<string.h>
int main()
{
   char str[101];int count=0,ans=0;
   scanf("%s",str);
   str[strlen(str)]='\0';
   for(i=0;i<strlen(str)-1;i++)
   {
      if(str[i]=='Q')
      {for(j=i+1;j<strlen(str);j++)
      {
         if(str[j]=='Q')
         {ans+=count;
         count=0;}
         if(str[j]=='A')
         count++;
      }}}
      printf("%d",ans);
      return 0;

}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="QAQ" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/QAQ" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/QAQ" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
		<Unit filename="main.c">
			<Option compilerVar="CC" />
		</Unit>
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include<stdio.h>
#include<string.h>
int main()
{
	char s[110];
	int i,j,k,n,sum=0;
	scanf("%s",&s);
	n=strlen(s);
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			for(k=j+1;k<n;k++){
				if(s[i]=='Q'&&s[j]=='A'&&s[k]=='Q')
				  sum++;

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


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n,k,largest=0,score0=0;
    scanf("%d",&n);
    int hl=(n+1/2);
    int a[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]>largest)
        {
            largest=a[i];
        }
        score0=score0+a[i];
    }
    int tk;
    for(int i=0;i<n;i++)
    {
        tk=hl*largest;
        if(score0<tk)
        {
            exit(0);
        }
        else()
        {
            ++largest;
        }
    }
    printf("%d",largest);
    return
}


#include<stdio.h>
int main(){
    int n ;
    scanf("%d",&n);
    max = 0;
    int x ;
    int total=0;
    int max=0 ;
    for(int i = 0 ; i < n ; i++){
        scanf("%d",&x);
        if(x>max)
            max = x;
        total+=x;
    }
    for(int i = 0 ; i < max ; i ++)
    {
        if(i*n > total){
            printf("%d",i);
            return 0;
        }
    }
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int i, n, k=0, score=0;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        score=score+a[i];
        if(a[i]>k)
        {
            k=a[i];
        }
    }
    int high;
    for(i=k;i<=1000000;i++)
    {
        high=k*n;
        if(score<=((high-1)/2))
        {
            break;
        }
        else
        {
            ++k;
        }
    }
    printf("%d",);
    return 0;
}


#include<stdio.h>

int main(){

	int students;
	scanf("%d", &students);
	int arr[students];
	int arr1[students];
	int max = -1;
	int count = 0;
	for(int i = 0 ; i < students ; i ++){
		scanf("%d", &arr[i]);
		count += arr[i];
		if(arr[i] > max)max = arr[i];
	}
	bool cek = true;
	int temp;
	while(cek){
		temp = 0;
		for(int i = 0 ; i < students ; i ++){
			arr1[i] = max - arr[i];
			temp += arr1[i];
		}
		if(temp < count){
			max++;
		}
		else{
			cek = false;
		}
	}
	printf("%d", max);

	return 0;
}


#include<stdio.h>
int main(){
    int n ;
    scanf("%d",&n);
    max = 0;
    int x ;
    int total=0;
    int res=0 ;
    for(int i = 0 ; i < n ; i++){
        scanf("%d",&x);
        if(x>max)
            max = x;
        total+=x;
    }
    for(int i = 0 ; i < max ; i ++)
    {
        if(i*n > total){
            printf("%d",i);
            return 0;
        }
    }
}


#include <stdio.h>

int main(){
    int a, b, c, sum = 0, r = 0;
    scanf("%d %d %d", &a, &b, &c);
    while(a >= 3 && b >= 2 && c >= 2){
        a -= 3;
        b -= 2;
        c -= 2;
        sum += 7;
    }
    int next, e, ccc, ee, aa, bb, cc;
    for(int i = 0; i < 7; i++){
        next = 1; e = i; ccc = 0; aa = a; bb = b; cc = c;
        while(next){
            ee = e%7;
            if(ee == 0 || ee == 3 || ee == 6){
                if(aa == 0){
                    next = 0;
                } else {
                    aa--;
                }
            } else if(ee == 1 || ee == 5){
                if(bb == 0){
                    next = 0;
                } else {
                    bb--;
                }
            } else {
                if(cc == 0){
                    next = 0;
                } else {
                    cc--;
                }
            }
            if(next){
                ccc++;
                e++;
            }
        }
        if(ccc > r){
            r = ccc;
        }
    }
    printf("%d", sum+r);
    return 0;
}


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

int compare_char(char *a,char *b){
	return strcmp(a,b);
}

int intsort(const void *a, const void *b){
	return *(int*)b - *(int*)a;
	/*qsort(a,aの配列数,sizeof(int),intsort);*/
}

int longsort(const void *a, const void *b){
	long *A=(long *)a;
	long *B=(long *)b;
	if(*A>*B) return -1;
	if(*A<*B) return 1;
	return 0;
}

int main(){
	int i,N,j,p,a[4]={0},b[i],cnt=0,min,ans=0,x,y,z,day=0;
	for(i=0;i<3;i++){
	scanf("%d",&a[i]);
	}
/*	if(a[0]%3==0){
*/

b[0]=a[0]/3;
min=b[0];
/*	}else{
		b[0]=a[0]/3+1;
	}
	if(a[1]%2==0){
*/
b[1]=a[1]/2;
if(min>b[1])min=b[1];
/*	}else{
		b[1]=a[1]/2+1;
	}
	if(a[2]%2==0){
*/
b[2]=a[2]/2;
if(min>b[2])min=b[2];
/*	}else{
		b[2]=a[2]/2+1;
	}
*/

ans=min*7;
a[0]-=3*min;
a[1]-=2*min;
a[2]-=2*min;
min=0;
x=a[0];
y=a[1];
z=a[2];
	//sun
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	}
	min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
				//月
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//火曜
	while(1){
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//水曜
	while(1){
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//木曜
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//金曜
	while(1){
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

day=0;
x=a[0];
y=a[1];
z=a[2];

			//土曜
	while(1){
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

printf("%d\n",ans+min);
	return 0;
}


#include<stdio.h>
int main()
{
    int a,ac,b,bc,cc,c,n,i,days=0,j;
    scanf("%d %d %d",&a,&b,&c);

    for(j=1;j<8;j++)
    {
        n=0;
        ac=a;
        bc=b;
        cc=c;
        i=j;
        while(1)
        {

            if(i==1||i==4||i==7)
            {
                if(ac==0)break;
                ac--;
            }
            else if(i==2||i==6)
            {
                if(bc==0)break;
                bc--;
            }
            else
            {
                if(cc==0)break;
                cc--;
            }
            if(i==7)i=1;
            else i++;
            n++;
            //printf("%d %d %d\n",ac,bc,cc);
        }
        if(days<n)days=n;
    }
    printf("%d",days);
}


#include<stdio.h>
int main(){
	long long ans[10]={0},max,flag,count[4]={0},a,b,c,i;
	scanf("%lld%lld%lld",&a,&b,&c);
	count[1]=a;
	count[2]=b;
	count[3]=c;
        for(i=1;i<=7;i++)
	{
		flag=i;
		count[1]=a;
		count[2]=b;
		count[3]=c;
		while(1)
		{
			//start monday
			if(flag==1)
			{
				if(count[1]==0)
					break;
				count[1]--;
				ans[i]++;
				flag=2;
			}
			if(flag==2)
			{
				if(count[2]==0)
					break;
				count[2]--;
				ans[i]++;
				flag=3;
			}
			 if(flag==3)
                        {
                                if(count[3]==0)
                                        break;
                                count[3]--;
                                ans[i]++;
                                flag=4;
                        }
			  if(flag==4)
                        {
                                if(count[1]==0)
                                        break;
                                count[1]--;
                                ans[i]++;
                                flag=5;
                        }
			   if(flag==5)
                        {
                                if(count[3]==0)
                                        break;
                                count[3]--;
                                ans[i]++;
                                flag=6;
                        }
			    if(flag==6)
                        {
                                if(count[2]==0)
                                        break;
                                count[2]--;
                                ans[i]++;
                                flag=7;
                        }
			     if(flag==7)
                        {

                                if(count[1]==0)
                                        break;
                                count[1]--;
                                ans[i]++;
				flag=1;
                        }
		}
	}

	max=0;
	for(i=1;i<=7;i++)
	{
	//	printf("%lld\n",ans[i]);
		if(ans[i]>=max)
			max=ans[i];
	}
	printf("%lld\n",max);
	return 0;
}


#include<stdio.h>
int main(){
    int x;
    scanf("%d",&x);
    printf("%d",2-x*x);
}


#include<stdio.h>
void main()
{
    int b;
    scanf("%d",&b);
    printf("%d",2-b*b);
}


#include<stdio.h>
void main()
{
    int a;
    scanf("%d",&a);
    printf("%d",a);
}


#include<stdio.h>
void main()
{
    int a;
    scanf("%d",&a);
    printf("1");
}


#include<stdio.h>
int main(){
int a;
cin>>a;
printf("%d",2-(a*a));
return 0;
}


#include <stdio.h>
int main() {
    int n;
    scanf("%d", &n);
    char input[20];
    scanf("%s", input);
    int digitCount[8] = {0,0,0,0,0,0,0,0};
    int i;
    for (i=0; i<n; i++) {
        if (input[i]>='2') {
            switch(input[i]) {
                case '9':
                    digitCount[7]++;
                    digitCount[3]+=2;
                    digitCount[2]++;
                break;
                case '8':
                    digitCount[7]++;
                    digitCount[2]+=3;
                break;
                case '6':
                    digitCount[5]++;
                    digitCount[3]++;
                break;
                case '4':
                    digitCount[3]++;
                    digitCount[2]+=2;
                break;
                default: // 2,3,5,7
                    int digit = input[i]-'0';
                    digitCount[digit]++;
            }
        }
    }
    char number[100];
    char *numberP = number;
    int digit;
    for (digit=7; digit>1; digit--) {
        char digitC = '0' + digit;
        for (i=0; i<digitCount[digit]; i++) {
            *numberP++ = digitC;
        }
    }
    *numberP = 0;
    printf("%s", number);

    return 0;
}


#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
using namespace std;
int main()
{
    int n;
    string a;
    gets(a);

}


#include <stdio.h>
int main() {
    int n;
    scanf("%d", &n);
    char input[20];
    scanf("%s", input);
    int digitCount[8]{0};
    for (int i=0; i<n; i++) {
        if (input[i]>='2') {
            switch(input[i]) {
                case '9':
                    digitCount[7]++;
                    digitCount[3]+=2;
                    digitCount[2]++;
                break;
                case '8':
                    digitCount[7]++;
                    digitCount[2]+=3;
                break;
                case '6':
                    digitCount[5]++;
                    digitCount[3]++;
                break;
                case '4':
                    digitCount[3]++;
                    digitCount[2]+=2;
                break;
                default: // 2,3,5,7
                    int digit = input[i]-'0';
                    digitCount[digit]++;
            }
        }
    }
    char number[100];
    char *numberP = number;
    for (int digit=7; digit>1; digit--) {
        char digitC = '0' + digit;
        for (int i=0; i<digitCount[digit]; i++) {
            *numberP++ = digitC;
        }
    }
    *numberP = 0;
    printf("%s", number);

    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define long long ll

int main(void)
{
    int fact[10];
    fact[0] = 1;
    int i;
    for (i = 0; i < 10; ++i) {
        fact[i] = i * fact[i-1];
    }
    int n;
    scanf("%d", &n);
    ll num;
    scanf("%lld", &num);
    unsigned ll org = 1;
    ll temp = num;
    while (temp > 0) {
        org *= fact[temp % 10];
        temp = temp / 10;
    }

    ll ans = 1000000000000000 - 1;
    ans = ans - num;


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

int ch_weight(char p);
int check_bw(char p[][8]);

int main(){
    char pan[8][8];
    char white[4][8];
    char black[4][8];

    int i,j,w_num=0,b_num=0;

    for(i=0;i<8;i++){
        for(j=0;j<8;j++){
        scanf("%c",&pan[i][j];
        }
    }

    if(check_bw(pan)==1){
        for(i=0;i<4;i++){
         for(j=0;j<4;j++){
             black[i][j]=pan[i][j];
             white[i][j]=pan[i+4][j];
         }
        }
    }
    else if(check_bw(pan)==2){
         for(i=0;i<4;i++){
         for(j=0;j<4;j++){
             black[i][j]=pan[i+4][j];
             white[i][j]=pan[i][j];
         }
        }
    }

    for(i=0;i<4;i++){
        for(j=0;j<4;j++){
            w_num+=ch_weight(white[i][j]);
            b_num+=ch_weight(black[i][j]);
        }
    }

    if(w_num>b_num)
        printf("White\n");
    else if(w_num<b_num)
        printf("Black\n");
    else
        printf("Draw\n");

        return 0;
}
int ch_weight(char p){
    swtich(p){
    case 'p':case'P':
        return 1;break;
        case 'q':case'Q':
        return 9;break;
            case 'b':case'B':
        return 3;break;
            case 'r':case'R':
        return 5;break;
            case 'k':case'K':
        return 3;break;
        default:
            return 0;break;
    }
}
int check_bw(char p[][8]){
    int i,j;

    for(i=0;i<4;i++){
        for(j=0;j<8;j++){
            if(p[i][j]>=97)
                return 1;
        }
    }
    return 2;
}


#include<stdio.h>
int main()
{
    int i,j,sum1,sum2;
    char chess[8][8];
    while(scanf("%c",&chess[0][0])!=EOF)
    {
        sum1=0;
        sum2=0;
        for(i=1;i<8;i++)
            scanf("%c",&chess[0][i]);
        getchar();
        for(i=1;i<8;i++)
        {
            for(j=0;j<8;j++)
                scanf("%c",&chess[i][j]);
            getchar();
        }
        for(i=0;i<8;i++)
            for(j=0;j<8;j++)
            {
                if(chess[i][j]=='Q')
                    sum1+=9;
                if(chess[i][j]=='q')
                    sum2+=9;
                if(chess[i][j]=='R')
                    sum1+=5;
                if(chess[i][j]=='r')
                    sum2+=5;
                if(chess[i][j]=='B')
                    sum1+=3;
                if(chess[i][j]=='b')
                    sum2+=3;
                if(chess[i][j]=='N')
                    sum1+=3;
                if(chess[i][j]=='n')
                    sum2+=3;
                if(chess[i][j]=='P')
                    sum1==1;
                if(chess[i][j]=='p')
                    sum2+=1;
        if(sum1>sum2) printf("White\n");
        else if(sum1<sum2) printf("Black\n");
        else printf("Draw\n");
    }
    return 0;
}


#include<stdio.h>
int main()
{
    int i,j,w=0,b=0;
    char a;
    for(j=0;j<64;j++)
    {
        scanf("%c",&a);
        switch(c)
        {
        case 'q': b+=9; break;
        case 'r': b+=5; break;
        case 'b': b+=3; break;
        case 'n': b+=3; break;
        case 'p': b+=1; break;
        case 'Q': w+=9; break;
        case 'R': w+=5; break;
        case 'B': w+=3; break;
        case 'N': w+=3; break;
        case 'P': w+=1; break;
        }
}
    if(w=b)
        printf("Draw");
    if(w>b)
        printf("White");
        if(w<b)
        printf("Black");
        return 0;
}


#include<stdio.h>
int main()
{
    char z;
    int i,j,upper=0,lower=0;
    for(i=0;i<n;i++)
    {
    	for(j=0;j<n;j++)
	{
	    scanf("%c",&z);
	    if(z=='Q')upper +=9;
		else if(z=='R')upper +=5;
    		else if(z=='B')upper +=3;
		else if(z=='K')upper +=3;
		else if(z=='P')upper +=1;
		else if(z=='q')lower +=9;
		else if(z=='r')lower +=5;
		else if(z=='b')lower +=3;
		else if(z=='k')lower +=3;
		else if(z=='p')lower +=1;
	}
    }
    if(lower>upper)
	printf("Black");
    else if(upper<lower)
	printf("White");
    else
	printf("Draw");
return 0;

}


#include<stdio.h>
int main()
{
	int n,d,array[n],i,t;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%d",&array[i]);
	}
	d=(array[n-1]-array[0])/(n-1);
	t=array[0]+(n*d);
	printf("%d",t);
}


#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
    int n;
    cin>>n;

    int a[n];
    int i;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    int sum = abs(a[2]-a[1]),c=0,temp;
    int x = a[2]-a[1];

    for(i=1;i<=n;i++)
    {
         if((abs(a[i]-a[i+1]))==sum)
         {
             c++;
         }
    }
    if(c==n-1)
    {
        if(0<=a[n])
        {

            temp = a[n]+x;
            cout<<temp;
        }
        else{
            temp = a[n]+x;
            cout<<temp;
        }
    }
    else{
        cout<<a[n];
    }

}


#include <studio.h>

int main() {

int n;
int diff;
int noprog=0;
scanf("%d", &n) ;

int temp1, temp2;
scanf("%d", &temp1) ;
scanf("%d", &temp2) ;
diff = temp2-temp1;
int i;
for(i=0;i<(n-2);i++){
temp1=temp2;
scanf("%d", &temp2) ;
if(temp2-temp1!=diff) {
noprog=1;
}
}
if(noprog==1) printf("%d", temp2);
else printf("%d", temp2+diff) ;
return 0;
}


#include <stdio.h>
int main() {
    int n, tb, i, A[100];
    FILE *file = fopen ("td.txt","r");
	fscanf (file,"%d",&n);
	for (i=0; i<n; i++) {
		fscanf (file,"%d",&A[i]);
	}
	tb = A[1] - A[0];
 	for (i=2; i<n; i++) {
 		if (tb != A[i] - A[i-1]) tb = 0;
	 }
	 printf ("%d", A[n-1] + tb);
    return 0;
}


#include<stdio.h>
int main()
{
short int n,array[n],i,t,d[n-1],m;
	scanf("%hd",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%hd",&array[i]);
	}
	m=(array[n-1]-array[0])/(n-1);
	for(i=0;i=n-2;i++)
	{
		d[i]=array[i+1]-array[i];
	}
		for(i=0;i=n-2;i++)
	{
		if(d[i]==d[i+1])
		{
			t=array[0]+(m*d[0]);
		}
		else
		{
		t=array[n-1];
		break;
	}
	}
	printf("%hd",t);
}


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

int main(int argc, char *argv[]) {

	int n, i, j, max = 2010, min = 2100;
	scanf("%d", &n);
	int a[n];
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}

	for (i = 0; i < n; i++) {
		if (a[i] > max) {
			max = a2[i];

		}
		if (a[i] < min) {
			min = a[i];
		}
	}

	printf ("%d", (min + max) / 2);
	return 0;
}


#include<stdio.h>>
int main(void)
{
    int i,j,n,min,dif=0,dif1;
    scanf("%d",&n);
    int year[n];
    for(i=0;i<n;i++)
        scanf("%d",&year[i]);
    for(i=0;i<n-1;i++)
    {
        min=year[i];
        for(j=i+1;j<n;j++)
            min=min<year[j]?min:year[j];
        for(j=i+1;j<n;j++)
        {
            if(min==year[j])
            {
                year[j]=year[i];
                year[i]=min;
                break;
            }
        }
    }
    for(i=1;i<n;i++)
    {
        dif1=year[i]-year[i-1];
        if(dif1>dif)
            dif=dif1;
    }
    printf("%d\n",year[0]+dif);
    return 0;
}


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

int main(int argc, char const *argv[])
{
	int n, *a, i, amin = 2100, x = 0;
	scanf("%d", &n);
	a = (int *) malloc (sizeof(int) * n);

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

	if (n < 2) {
		return 0;
	}

	for (i = 0; i < n; i++) {
		if (a[i] < amin)
			amin = a[i];
	}

	for (i = 1; i < n; i++) {
		if ((abs(a[i] - a[i-1])) > x)
			x = (abs(a[i] - a[i-1]));
	}

	printf("%d\n", amin+x);

	/* for (i = 0; i < n; i++) {
		if
	} */
	return 0;
}


#include<stdio.h>
#include<conio.h>
void main()
{
int x[100],n,i;
//float mean(int,int[]);
int median(int,int[]);
//clrscr();
scanf("%d",&n);
for(i=0;i<n;i++)
    scanf("%d",&x[i]);
//printf("mean=%f\n",mean(n,x));
printf("%d\n",median(n,x));
//getch();
}

/*float mean(int m, int a[]) {
    int sum=0, i;
    for(i=0; i<m; i++)
        sum+=a[i];
    return((float)sum/m);
}
*/

int median(int n, int x[]) {
    int temp;
    int i, j;
    // the following two loops sort the array x in ascending order
    for(i=0; i<n-1; i++) {
        for(j=i+1; j<n; j++) {
            if(x[j] < x[i]) {
                // swap elements
                temp = x[i];
                x[i] = x[j];
                x[j] = temp;
            }
        }
    }

    if(n%2==0) {
        // if there is an even number of elements, return mean of the two elements in the middle
        return((x[n/2] + x[n/2 - 1]) / 2.0);
    } else {
        // else return the element in the middle
        return x[n/2];
    }
}


#include <stdio.h>
using namespace std;

int main(){
	int l,r,x,y;
	double k;
	scanf("%d%d%d%d%lf",&l,&r,&x,&y,&k);

	for (int i=x;i<=y;i++){
		double tar = i*k;
		int tari = (int)tar;
		if (tari-tar==0){
			if (tari<=r&&tari>=l){
				printf("YES");
				return 0;
			}
		}
	}
	printf("NO");
	return 0;
}


r,d=map(int,input().split())
count=0
for i in range(int(input())):
    x,y,r1 = map(int,input().split())
    k = (x*x+y*y)**0.5
    if (k-r1)>=(r-d) and (k+r1)<=r:
        count+=1
print(count)


#include<stdio.h>
int main()
{
    long long int l,r,x,y;
    float k;
    scanf("%I64d%I64d%I64d%I64d%f",&l,&r,&x,&y,&k);
    long long int ans;
    ans=0;
    while(x<=y)
    {
        j=x*k;
        if(l<=j && j<=r)
        {
            ans=1;
            break;
        }
        x+=1;
    }
    if(ans==1){
        printf("YES");
    }
    else{
        printf("NO");
    }
    return 0;
}


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

int main(){
	int l,r,x,y;
	double k;
	cin>>l>>r>>x>>y>>k;

	for (int i=x;i<=y;i++){
		double tar = i*k;
		int tari = (int)tar;
		if (tari-tar==0){
			if (tari<=r&&tari>=l){
				printf("YES");
				return 0;
			}
		}
	}
	printf("NO");
	return 0;
}


#include <stdio.h>

int main(void){
	long long int l, r, x, y, k;
	scanf("%lld%lld%lld%lld%lld",&l,&r,&x,&y,&k);
	long long int a = 1;
	a = x;
	while(1){
		if(k*a < l || a < x){
			a++;
		} else{
			break;
		}
	}
	long long int flag = 0;
	while(k*a <= r && a <= y){
		if(k*a <= r && a <= y){
			flag = 1;
			break;
		}
		a++;
	}
	if(flag == 1){
		printf("YES\n");
	} else{
		printf("NO\n");
	}
	return 0;


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

int main(int argc, char *argv[])
{
  int n=0,m=0;
  scanf("%i%i",&n,&m);
  int pontos=n*m,jogador=1;

  if(posntos==1){
  printf("Akshat\n");
  }else{
  while(1){
  pontos-=2;
   jogador++;
  if(pontos==1){
  printf("Akshat\n");
  break;
  }else if(pontos<=0){
  printf("Malvika\n");
  break;
        }

  }
}
  return 0;
}


#include<stdio.h>
int main()
{
    int horizontal,vertical;
    scanf("%d %d",&horizontal,&vertical);
    if(horizontal%2==0 && vertical%2==0)
    {
        printf("Malvika\n");
    }
     if(horizontal%2==1 && vertical%2==1)
    {
        printf("Akshat\n");
    }
     if(horizontal%2==1 && vertical%2==0)
    {
        printf("Akshat\n");1
    }
     if(horizontal%2==0 && vertical%2==1)
    {
        printf("Malvika\n");
    }
    return 0;
}


#include<stdio.h>
int main()
{
    int i,c=0,j,a[100,100];
    scanf("%d %d",&n,&m);
    if(m<n)
        n=m;
    puts(n%2?"AKSHAT":"MALVIKA");
    return 0;
}


#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a%2==0)
    {
        print("Malvika");
    }
    else
    {
        printf("Akshat");
    }
}


#include <stdio.h>
#include <string.h>
#define MAX_ARRAY 1500

int main(void)
{
	int num = 0;
	int i = 0, j = 0;
	int share, remainder;
	char numArr[MAX_ARRAY] = { 0 };

	while (j + 1 < 400)
	{
		share = (j + 1) / 10;
		remainder = (j + 1) % 10;

		if (share == 0)
		{
			numArr[i++] = remainder;
		}
		else if (share >= 1 && share <= 9)
		{
			numArr[i++] = share;
			numArr[i++] = remainder;
		}
		else if (share >= 10)
		{
			numArr[i++] = share / 10;
			numArr[i++] = share % 10;
			numArr[i++] = remainder;
		}
		j++;
	}

	while (1)
	{
		printf("input : ");
		scanf_s("%d", &num);

		if (num >= 1 && num <= 1000)
		{
			printf("%d \n", numArr[num - 1]);
			break;
		}
		else
		{
			printf("���Է�! (range : 1 ~ 1000) \n");
			continue;
		}
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#define MAX_ARRAY 1500

int main(void)
{
	int num = 0;
	int i = 0, j = 0;
	int share, remainder;
	char numArr[MAX_ARRAY] = { 0 };

	while (j + 1 < 400)
	{
		share = (j + 1) / 10;
		remainder = (j + 1) % 10;

		if (share == 0)
		{
			numArr[i++] = remainder;
		}
		else if (share >= 1 && share <= 9)
		{
			numArr[i++] = share;
			numArr[i++] = remainder;
		}
		else if (share >= 10)
		{
			numArr[i++] = share / 10;
			numArr[i++] = share % 10;
			numArr[i++] = remainder;
		}
		j++;
	}

	while (1)
	{
		printf("input : ");
		scanf_s("%d", &num);

		if (num >= 1 && num <= 1000)
		{
			printf("%d \n", numArr[num - 1]);
			break;
		}
		else
		{
			printf("! (range : 1 ~ 1000) \n");
			continue;
		}
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n,i;
    char a[10000];
    a[0]='1';
    for(i=2;i<1000,i++)  sprintf(a,"%s%d",a,i);
    scanf("%d",&n);
    printf("%c",a[n-1]);
    return 0;
}


#include <stdio.h>
int main()
{
    pritnf("NO");
}


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

	printf("No\n")

	return 0;
}


#include <stdio.h>
#define maxn 1000000005
int bit[maxn];
int main()
{
    int w,m,b=0,i,f=0;
    scanf("%d%d",&w,&m);
    while (m)
    {
        bit[b++]=m%w;
        m/=w;
    }
    for (i=0;i<b;i++)
    {
        if (bit[i]>=w)
        {
            bit[i]-=w;
            bit[i+1]++;
        }
        if (bit[i]==w-1)
        {
            bit[i]=0;
            bit[i+1]++;
        }
        if (bit[i]>1)
        {
            f=1;
            break;
        }
    }
    if (f==0) printf("YES");
    else printf("NO");
    return 0;
}


#include <stdio.h>
#define maxn 1000000005
long long bit[maxn];
int main()
{
    int w,m,b=0,i,f=0;
    scanf("%d%d",&w,&m);
    while (m)
    {
        bit[b++]=m%w;
        m/=w;
    }
    for (i=0;i<b;i++)
    {
        if (bit[i]>=w)
        {
            bit[i]-=w;
            bit[i+1]++;
        }
        if (bit[i]==w-1)
        {
            bit[i]=0;
            bit[i+1]++;
        }
        if (bit[i]>1)
        {
            f=1;
            break;
        }
    }
    if (f==0) printf("YES");
    else printf("NO");
    return 0;
}


#include <stdio.h>

int main(){
	int m,w;
	scanf("%d %d",&w,&m);
	while(m>0){
		if(m%w==0||m%w==1||m%w=w-1){
			m=m/w;
		}
		else{
			printf("NO");
			return 0;
		}
		}
		printf("YES");
		return 0;
	}


#include <iostream>

using namespace std;

bool getans(long long w,long long m){
	long long current = m;
	long long remain = 0;
	long long bit = 0;
	while(current){
		remain = current % w;
		current = current / w;
		if(remain==1||remain==0)
			continue;
		if(remain==w-1)
			current++;
		else return false;
	}
	return true;
}

int main()
{
	long long w,m;
	cin>>w>>m;
	if(getans(w,m))
		cout <<"YES"<<endl;
	else cout<<"NO"<<endl;
}


#include <stdio.h>
int main(void)
{
	long long w,m;
	scanf("%I64d%I64d",&w,&m);
	while (m>0)
	{
		if (m%w==w-1) m++;
		if (m%w>1)
		{
			printf("NO\n");
			return 0;
		}
		m/=w;
	}
	printf("YES\n");
	return 0;
	return 0;
}


#include<stdio.h>

int main(void)
{
	int n;
	int str[100];
	int i;
	int check_yes; // yes 떴는지 체크
	int check_blank; // 빈칸인지 체크
	int check_cont; // 연속 2개 이상인지  체크
	int check_test0;

	check_yes = 0;
	check_blank = 0;
	check_test0 = 0;

	scanf("%d", &n);
	scanf("%s", str);

	//test 0: 그냥 안 되는 경우 (ex: ??CCY)

	for(i = 0; i < n-1; i++)
	{
		if(str[i] != '?' && str[i] == str[i+1])
		{
			printf("No");
			check_test0 = 1;
			break;
		}`````````````
	}

	printf("%d", check_test0);

	if(check_test0 == 0)
	{
		//test 1: 시작과 끝을 보자
		if(str[0] == '?' || str[n-1] == 0)
		{
			printf("Yes");
			check_yes = 1;
		}
		else
		{
			//test 2: ?가 2번이상 연속되는지 체크
			for( i = 0; i < n; i++)
			{
				if(str[i] == '?')
				{
					check_blank++;
					if(check_blank == 2)
					{
						printf("Yes");
						check_yes = 1;
						break;
					}
				}
				else
				{
					check_blank = 0;
				}
			}
			//test 3: A?A 꼴 체크
			if(check_yes == 0)
			{
				for( i = 1; i < n-1; i++)
				{
					if(str[i] == '?' && str[i-1] == str[i+1])
					{
						printf("Yes");
						check_yes = 1;
						break;
					}
				}
			}
		}

		if(check_yes == 0)
		{
			printf("No");
		}
	}

	return 0;
}


/*Problem 957A Tritonic Iridescence*/
#include <stdio.h>
int main()
{
    int i, n;
    char string[100];

    scanf("%d", &n);
    scanf("%s", string);

    for (i = 0; i < n; i++)
        if (string[i] == string[i + 1] && string[i] != '?')
        {
            print("No");
            return 0;
        }

    for (i = 1; i < n - 1; i++)
    {
        if (string[i] == '?' && (string[i - 1] == string[i + 1] || string[i + 1] == '?'))
        {
            printf("Yes");
            return 0;
        }
    }
    if (string[0] == '?' || string[n - 1] == '?')
    {
        printf("Yes");
        return 0;
    }

    printf("No");
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
{
    long long int i,j,k=0,n;
    char ch[100000],cp='k';
    scanf("%I64d",&n);
    gets(ch)
    for(i=0;i<n;i++){
       // scanf("%c",&ch);
        if(cp==ch[i] && ch[i!='?')
        {
            printf("No\n");
            return 0;
        }

        else
            cp=ch[i];
        if(ch[i]=='?')
            k=1;
    }
    if(k==1)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


#include<stdio.h>
int main()
{
  int i,j,n,count=0,factor=0,equal=0;

  scanf("%d",&n);

  int b[n],c[n];
  for(i=1;i<=n;i++)
  {
      scanf("%d",&b[i]);
  }
  printf("\n");
  for(i=1;i<=n;i++)
  {
      scanf("%d",&c[i]);
  }1

  for(i=1;i<=n;i++)
  {
    if(b[i]<c[i])
      count++;
    else
    {
      if(b[i]>c[i])
        factor++;
    }
  }

  for(i=1;i<=n;i++)
  {
    if(b[i]==c[i])
      equal++;
  }

  if(equal==n)
  {
    printf("%d",-1);
  }
  else
  {
    if(factor!=0)
      printf("%d",(int)(count/factor)+1);
    else
    {
      printf("%d",1);
    }
  }
  return 0;
}


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

int main()
{
    int T;
    scanf("%d",&T);
    int a[T];
    int b[T];
    int i;
    for(i=0;i<T;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<T;i++){
        scanf("%d",&b[i]);
    }
    int  a_win=0;
    int b_win=0;

    for(i=0;i<T;i++){
         if(a[i]==1&&b[i]==0){
            a_win++;
         }
         if(a[i]==0&&b[i]==1){
            b_win++;
         }
    }

    if(a_win==0){
        printf("-1\n");
    }
    else{
        int t=1;
        while(1){
            if(t*a_wins>b_wins)
               break;
            t++;
        }

        printf("%d\n",t);
    }

    return 0;
}


#include<stdio.h>
int main()
{
  int i,j,n,count=0,factor=0,equal=0;

  scanf("%d",&n);

  int b[n],c[n];
  for(i=1;i<=n;i++)
  {
      scanf("%d",&b[i]);
  }
  printf("\n");
  for(i=1;i<=n;i++)
  {
      scanf("%d",&c[i]);
  }1

  for(i=1;i<=n;i++)
  {
    if(b[i]<c[i])
      count++;
    else
    {
      if(b[i]>c[i])
        factor++;
    }
  }

  for(i=1;i<=n;i++)
  {
    if(b[i]==c[i])
      equal++;
  }

  if(equal==n)
  {
    printf("%d",-1);
  }
  else
  {
    if(factor!=0)
      printf("%d",(int)(count/factor)+1);
    else
    {
      printf("%d",-1);
    }
  }
  return 0;
}


#include<stdio.h>
int main()
{
    int i,n,count=0,factor=0,equal=0;

    scanf("%d",&n);

    int b[n],c[n];

    for(i=1;i<=n;i++)
    {
        scanf("%d",&b[i]);
    }
    printf("\n");

    for(i=1;i<=n;i++)
    {
        scanf("%d",&c[i]);
    }

    for(i=1;i<=n;i++)
    {
        if(b[i]<c[i])
            count++;
        else
        {
            if(b[i]>c[i])
                factor++;
        }
    }

    for(i=1;i<=n;i++)
    {
        if(b[i]==c[i])
            equal++;
    }

    if(equal==n)
    {
        printf("%d",-1);
    }
    else
    {
        if(factor!=0)
            printf("%d", (int)(count/factor)+1)
    }

    return 0;

}


#include <iostream.h>
int main(){
    int n,ans=0,temp,i;
    scanf("%d",&n);
    i=0;
    while(n>0){
        temp=n%10;
        temp=(temp==4)?1:2;
        ans+=(temp*(1<<i));
        n=n/10;
        i++;
    }
    printf("%d\n",ans);
}


#include <stdio.h>
int main(){
    long long int n,ans=0,temp,i;
    cin >> n;
    i=0;
    while(n>0){
        temp=n%10;
        temp=(temp==4)?1:2;
        ans+=(temp*(1<<i));
        n=n/10;
        i++;
    }
    printf("%lld\n",ans);
}


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

int main(void)
{
int i;
int n; scanf("%d",&n);
int happy;
int count1=0
int count2=0;
int tmp;
int sum;

count1++;

happy=n;

while(happy>0)
{
	tmp=happy%10;
	happy=happy/10;
	count1++;
}

happy=n;

while(happy>0)
{
	tmp=happy%10;
	happy=happy/10;
	count2++;
	if(tmp==7)
		break;
}

for(i=0;i<count1-count2;i++)
sum=sum*2;

printf("%d",sum);

return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
void main(){

    char p[20];
    scanf("%s",p);
    int ans = 1;
    int len = strlen(p)
    for(int i=0;i<len;i++){
        if(p[len-i-1]=='7')
            ans+=pow(2,i)
    }
    ans+=2*(pow(2,len-1)-1)
    printf("%d",ans)
}


#include <iostream>
int main(){
    long long int n,ans=0,temp,i;
    cin >> n;
    i=0;
    while(n>0){
        temp=n%10;
        temp=(temp==4)?1:2;
        ans+=(temp*(1<<i));
        n=n/10;
        i++;
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>

using namespace std;

int main(){
	int w, h, k;
	cin >>w>> h>>k;

	int ans= 0;
	for(inst i=1 ; i<=k; i++){
	ans=ans +(w+h) *2-4;

	}

	count<<ans;
	return 0;


#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int main(){
	scanf("%d%d%d",&n,&m,&k);
	int sum=0;
	while(k--){
		sum+=(n*2+(m-2)*2);
		n-=4,m-=4;
	}
	printf("%d\n",sum);
}


#include<iostream>
using namespace std;

int main()
{
    int n,a,x,b,y,k;
    cin>>n>>a>>x>>b>>y;
    while(a!=x||b!=y)
    {
        if(a!=x)
        {
            if(a==n)
                a=0;
            a++;
        }
        else
            k=0;

        if(b!=y)
        {
            if(b==1)
                b=n+1;
            b--;
        }
        else
            k=0;

        if(a==b)
        {
            k=1;
            break;
        }
    }
    if(k==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


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

int main()
{
    int n,a,x,b,y,flag=0;
    scanf("%d%d%d%d%d",&n,&a,&x,&b,&y);
    a--;x--;b--;y--;

    while (true) {
    if (a == b) {
      printf("YES\n");
      return 0;
    }
    if (a == x || b == y) {
      break;
    }
    a = (a + 1) % n;
    b = (b - 1 + n) % n;
  }
  printf("NO\n");
    return 0;
}


#include<stdio.h>
int main()
{
	int a,x,b,y,n;
	scanf("%d %d %d %d %d",&n,&a,&x,&b,&y);
	if(a==n+1)
	a=1;
	if(b==0)
	b=n;
	a=a+1;b=b-1
	if(a==b)
	{
	printf("yes");
return 0;
	}

	printf("no");
	return 0;
}


# include <stdio.h>
int main()
{
	int n,a,b,x,y,i,j=0;
	scanf("%d%d%d%d%d",&n,&a,&x,&b,&y);
	if(a==b)
		{
			printf("YES");
			j=1;
			break;
		}
		else
		{
	while(a!=x||b!=y)
	{
		if(a!=x)
		{
			if(a!=n)
			a++;
			else
			a=1;
		}
		if(b!=y)
		{
			if(b!=1)
			b--;
			else
			b=n;
		}
		if(a==b)
		{
			printf("YES");
			j=1;
		}
	}
		}
	if(j==0)
	printf("NO");

}


#include<iostream>
    using namespace std;
    int main()
        {
            int n,a,b;
            cin>>n>>a>>b;
            if(b<n&&b>=0)
                {
                    cout<<b+a;
                }
            if(b>n)
                {
                    cout<<((a+b)%n)+(a+b)/n;
                }
            if(b<0)
                {
                    b=-(b);
                    cout<<n-b+1;
                }

            return 0;
        }


#include<stdio.h>
int main()
{
int a,b,n,x;
scanf("%d%d%d",&n,&a,&b);
if(b<0 && n*a<(-b))
x=(n+a-b)%;n;
{
if(x==0)
printf("%d",n);
else
printf("%d",x);
}
else
x=(n+a+b)%n;
{
if(x==0)
printf("%d",n);
else
printf("%d",x);
}
return 0;
}


#include<stdio.h>
int main(int n,int x,int y)
{
s=(x+y)%n;
if(s<=0) s=s+n;
printf("%d",s);
}


#include<stdio.h>
int main()
{
int a,b,n,x;
scanf("%d%d%d",&n,&a,&b);
if(b<0 && n*a<(-b))
x=(n+a-b)%n;
{
if(x==0)
printf("%d",n);
else
printf("%d",x);
}
else
x=(n+a+b)%n;
{
if(x==0)
printf("%d",n);
else
printf("%d",x);
}
return 0;
}


#include <stdio.h>
#include <algorithm>
using namespace std;
int n,a,b,ans;
void step()
{
    ans=a;//初始为第a个门
    if(b<0)//b小于0时{
        while(1){
            ans--;//倒退，门的编号减小
            b++;
            if(ans<1){//如果走过了1号门
                ans=n;//编号变为n
            }
            if(b==0){//如果走完了
                return ;
            }
        }
    }
    if(b>0){//大于0时
        while(1){
            ans++;//前进，门的编号增加
            b--;
            if(ans>n){//如果走过了n号门
                ans=1;//编号变为1
            }
            if(b==0){//如果走完了
                return ;
            }
        }
    }
    return ;
}
int main(){
    scanf("%d%d%d",&n,&a,&b);
    step();
    printf("%d",ans);
    return 0;
}


include<stdio.h>
include<math.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    d=(int)sqrt(a*b*c);
    int N=4*(d/a+d/b+d/c);
    printf("%d",N);
    return 0;

}


#include<stdio.h>
#include<math.h>
{
    int main()
    {
        int a,b,c,l,w,h;
        l=4*sqrt(c/(a*b));
        w=sqrt((a*b)/c);
        h=w*(c/a);
        printf("%d", 4*(l+w+h));
        return 0;
    }
}


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

int main(){
    int x,y,z,a,b,c;
    scanf("%d %d %d",&x,&y,&z);
    c=(int)xy/z;
    b=(int)xz/y;
    a=(int)yz/x;
    printf("%d",(a+b+c)*4);
    return 0;
}


#include<stdio.h>
#include<math.h>
{
    int main()
    {
        int a,b,c,l,w,h;
        scanf("%d%d%d",&a,&b,&c);
        l=4*sqrt(c/(a*b));
        w=sqrt((a*b)/c);
        h=w*(c/a);
        printf("%d", 4*(l+w+h));
        return 0;
    }
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int valid(char c){
    if((c>='A' && c<='z')|| (c>='0'&&c<='9') || c=='_') return 1;
    return 0;
}
void no(){
    printf("NO\n");
    exit(0);
}
int main()
{
    //freopen("in.txt", "r", stdin);
    char id[110];
    fgets(id,110, stdin);

    char *user, *host, *res;

    if(id[0]=='@') no();
    if(id[strlen(id)-2]=='/') no();

    user = strtok(id, "@");
    host = strtok(NULL, "/");
    if(host==NULL) {
        host=strtok(NULL, "\n");
        res=NULL;
    }
    else {
        res = strtok(NULL, "\n");
    }

    //printf("%s %s %s\n", user, host, res);

    if(user==NULL || host==NULL) no();
    if(strlen(user)>16 || strlen(host)>32) no();

    int i;

    if(user){
        for(i=0; user[i]!='\0'; i++){
            if(!valid(user[i])) no();
        }
    }
    int word=0;
    if(host){
        for(i=0; host[i]!='\0'; i++){
            if(valid(host[i])) word++;
            else if(host[i]=='.'){
                if(word<1 || word>16) no();
                word=0;
            }
            else{
                if(host[i]!='\n') no();
            }
        }
    }
    if(word==0) no();

    if(res){
        for(i=0; res[i]!='\0'; i++) {
            if(!valid(res[i])) no();
        }
    }
    //printf("%s %s %s\n", user, host, res);
    printf("YES\n");
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>//ͷ�ļ���������isalnum�����������ж�һ����ĸ�Ƿ�Ϊ��ĸ��������
int check_hostname(char *hostname)
{
	int i=0,len=0,max_len=0,min_len=1000;
	while (i <= strlen(hostname))//��������i<=sttrlen(hostname),�������ܽ����С�.���ָ���ַ�������ɨ�������������ˣ���ֻ����
	{                            //����һ�����ַ���������������Ϊ������ɵġ�
		len = 0;
		while (hostname[i] != '.'&& hostname[i] != 0)
		{
			len++;
			i++;
		}
		if (len > max_len)
			max_len = len;
		if (len < min_len)
			min_len = len;
		i++;
	}
	if (min_len == 0 || max_len > 16)
		return 1;
	else
		return 0;
}
int check_resource(char *resource)
{
	int i=0, len, max_len = 0, min_len = 1000;
	while (i <= strlen(resource))
	{
		len = 0;
		while (resource[i] != '/'&&resource[i] != 0)
		{
			len++;
			i++;
		}
		if (len > max_len)
			max_len = len;
		if (len < min_len)
			min_len = len;
		i++;
	}
	if (min_len == 0 || max_len > 16)
		return 1;
	else
		return 0;
}
int main()//�����˼·������������˼·��һ������д���Ǹ������ܹ�ʵ�ֺ����ĺܺõı䶯�ԣ������ǡ������Ķ��٣�ʹ����û�취�ܹ���
{         //�Ƚ���ȷ�Ĳ��裬�����˲�ȷ���ԣ�ʹ�����޷�͸���ķ�������д�ĳ��������stotok����û����������ʶ�������˽������©��
	     //���ַֿ�����ķ���ֵ��˼����
	char str[101], username[101], hostname[101], resource[101];
	int len;
	int i,j;
	int at,point,res,next;
	at =point =res=next=0;
	scanf("%s", str);
	len = strlen(str);
	for (i = 0; i < len; i++)
		if (str[i] == '@')
		{
			at = 1;
			break;
		}
	if (!at)
	{
		printf("NO\n");
		exit(0);
	}
	for (++i; i < len; i++)
	{
		if (str[i] == '.')
			point = 1;
		if (str[i] == '/')
			res = 1;
	}
	for (i = 0, j = 0; str[i] != '@'; i++,j++)
		username[j] = str[i];
	username[j] = 0;
	if (res)
	{
		for (++i, j = 0; str[i] != '/'; i++, j++)
			hostname[j] = str[i];
		hostname[j] = 0;
		for (++i,j=0; str[i] != 0; i++,j++)
			resource[j] = str[i];
		resource[j] = 0;
	}
	else
	{
		for (++i, j = 0; str[i] != 0; i++, j++)
		{
			hostname[j] = str[i];
		}
		hostname[j] = 0;
		resource[0] = 0;
	}
	for (i = 0; i < strlen(username); i++)
		if (!(isalnum(username[i]) || username[i] == '_'))
			next = 1;
	for (i = 0; i < strlen(hostname); i++)
		if (!(isalnum(hostname[i]) || hostname[i] == '_' || hostname[i] == '.'))
			next = 1;
	for (i = 0; i < strlen(resource); i++)
		if (!(isalnum(resource[i]) || resource[i] == '_' || resource[i] == '/'))
			next = 1;
	if (strlen(username) > 16 || strlen(username) == 0)
		next = 1;
	if (strlen(hostname) > 32 || strlen(hostname) == 0||check_hostname(hostname))
		next = 1;
	if (res && check_resource(resource))
		next = 1;
	(next) ? printf("NO\n") : printf("YES\n");
	return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
    int b='a',c=0;
    char a[510];
    scanf("%s",a);
    if(b==a[c])
    {
        b++;
        c++;
    }
    else if(b>a[c])
        c++;
    else
    {
        printf("NO");
        return;
    }
    printf("YES");
}


#include <stdio.h>
int temp[26];
int main()
{
    char s[52];
    int i, j, k;
    gets(s);
    if(s[0] != 'a'){ printf("NO\n"); return 0;}
    else temp[0] = 1;
    for(i = 1; s[i] != '\0'; i++){
        j = s[i] - 97;
        if(s[i] > s[i-1] || temp[j] != 0){
            temp[j] = 1;
        }
        else{
            printf("NO\n"); return 0;
        }
    }
    printf("YES\n");
}


#include <stdio.h>
int temp[26];
int main()
{
    char s[52];
    int i, j, k, t;
    gets(s);
    if(s[0] != 'a')
    {
        printf("NO\n");
        return 0;
    }
    else
    {
        temp[0] = 1;
        t = 1;
    }
    for(i = 1; s[i] != '\0'; i++)
    {
        j = s[i] - 97;
        if(j >t)
        {
            printf("NO\n");
            return 0;
        }

        if(j==t) t++;
    }
    printf("YES\n");
}


#include <stdio.h>
#include <string.h>
int steman(char cad[]);

int main(void) {
	char cad[28];

	scanf("%s",cad);
	if (steman(cad)) printf("YES");
	else printf("NO");
	return 0;
}

int steman(char cad[]){
	int i,cont=0,n=strlen(cad);
	for(i=0;i<n;i++){
		if(cad[i]<'a'+cont){

		}
		else if(cad[i]=='a'+cont){
			cont++;
			}
		else break;
	}
	if (i==n) return 1;
	else return 0;
}
Fin de la conversación


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

int main()
{
	int n, i, f=0;
	char s[501], t='a';
	n = strlen(s);
	scanf_s("%s", s);
	if (s[0] != t)
	{
		f++;
		printf("NO");
		return 0;
	}

	for (i = 1; i < n; i++)
	{
		if (t+1 < s[i])
		{
			f++;
			break;
		}
		if (t + 1 == s[i])
			t++;
	}
	if (f)
		printf("NO");
	else
		printf("YES");
	return 0;
}


#include<studio.h>
#include<conio.h>
int main()
{
  int n, a[10000],p=0,q=0, i;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
     scanf("%d",&a[i]) ;
     if(a[i] >0)
          p++;
     else if(a[i] <0)
           q++;
  }
  float f=n/2.0;
  if(p>=f)
     printf("1\n");
  else if(q>=c)
     printf("-1\n");
  else
      printf("0");
}


#include<stdio.h>
int main(void)
{
    int a[2000],d,n,b[2000];
    scanf("%d",&n);
    int i,count=0,count1;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    count1=(n/2)+1;
    d=count1+1;
    for(i=0;i<n;i++)
    {
        if(a[i]<=0 || a[i]==1)
        {
            count++;
        }
    }
    if(count>count1)
    {
        printf("0");
    }
    else
        printf("%d",d);


#include<stdio.h>
int main(void)
{
    int a[2000],d,n,b[2000];
    scanf("%d",&n);
    int i,count=0,count1,count2=0,count3=0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    count1=(n/2)+1;
    d=count1+1;
    for(i=0;i<n;i++)
    {
        if(a[i]<0)
        {
            //b[i]=a[i]/(-1);
            count++;
        }
        elseif(a[i]==0)
        {
            //c[i]=a[i];
            count2++;
        }
        else
            count3++;
    }

    if(count>count1)
    {
        printf("-1");
    }
    else if(count3>count1)
        printf("%d",d);
    else
        printf("0");
}


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

float pi=3.14159265358979323846;
int gcdf(int,int);

int main()
{
	float ax,ay,bx,by,cx,cy,a,b,c,tri_area,r_outersp,angle_a,angle_b,angle_c,edges,area,areas;
	int gcd;
	scanf("%f %f",&ax,&ay);
	scanf("%f %f",&bx,&by);
	scanf("%f %f",&cx,&cy);
	a = sqrt( (ax-bx)*(ax-bx) + (ay-by)*(ay-by) ) ;
    	b = sqrt( (bx-cx)*(bx-cx) + (by-cy)*(by-cy) ) ;
    	c = sqrt( (ax-cx)*(ax-cx) + (ay-cy)*(ay-cy) ) ;
	tri_area = sqrt((0.5*(a+b+c))*((0.5*(a+b+c))-c)*((0.5*(a+b+c))-b)*((0.5*(a+b+c))-c));
	r_outersp = a*b*c/(4*tri_area);
	angle_a = acos((b*b+c*c-a*a)/(2*b*c));
	angle_b = acos((a*a+c*c-b*b)/(2*a*c));
	angle_c = acos((a*a+b*b-c*c)/(2*b*a));
	gcd = gcdf((int)angle_a,(int)angle_b)
	gcd = gcdf(gcd,(int)angle_c);
	edges = 2*pi/gcd;
	area = r_outersp*r_outersp*sin(gcd)/2;
	areas = area*(int)edges;
	printf("%f",areas);
	return 0;
}

int gcdf(int m, int n)
{
	while(m>0){
		int c = n % m;
		n = m;
		m = c;
	}
	return n;
}