#include <stdio.h>
#include <stdlib.h>
#define min(a, b) ((a < b) ? (a) : (b))
#define max(a, b) ((a > b) ? (a) : (b))

int l = 1, r, answ, t = 1;
long long a[11];
long long ans[2048];
int b[13], use[13];
int n, m, k;

int
analyze(void)
{
    int i, nonzero = 0;
    long long tmp = 0;
    for(i = 10; i >= 0; --i){
        if(a[i] == 0 && nonzero){
            return 1;
        }
        tmp = tmp * 10 + a[i];
        if (a[i] != 0){
            nonzero = 1;
        }
    }
    if(tmp >= r){
        ans[n++] = tmp;
        return 0;
    }
    if(tmp >= l){
        ans[n++] = tmp;
    }
    return 1;
}

void
go(int i)
{
    if(!t){
        return;
    }
    if (i == -1){
        t = analyze();
        return;
    }
    a[i] = 0;
    go(i - 1);
    a[i] = 4;
    go(i - 1);
    a[i] = 7;
    go(i - 1);
}

void
gen(int n, int p, int k){
if(p > 0){
    int i, ans = 1;
    for(i = 1; i <= p - 1; ++i){
        ans *= i;
    }
    int tmp = k / ans;
    if(k % ans == 0){
        --tmp;
    }
    if (tmp >= n){
        printf("-1");
        m = -1;
        return;
    }
    for(i = 0; ; ++i){
        if(use[i] == 0){
            if(tmp > 0){
                --tmp;
            } else {
                use[i] = 1;
                b[n - p] = i;
                break;
            }
        }
    }
    gen(n, p - 1, k % ans ? k % ans : ans);
}
}

int
main(void)
{
    scanf("%d%d", &m, &k);
    r = m;
    go(10);
    answ = 0;
    int i, j, q;
    for(i = 0; ans[i] <= m - 13; ++i){
        ++answ;
    }
    gen(min(13, m), min(13, m), k);
    if(m == -1){
        return 0;
    }
    for(i = 0; i < min(13, m); ++i){
        b[i] += max(1, m - 12);
    }
    for(i = max(1, m - 12); i <= m; ++i){
        for(j = 0; j < n; ++j){
            if(ans[j] == i){
                for(q = 0; q < n; ++q){
                    if(b[i - max(1, m - 12)] == ans[q]){
                        ++ answ;
                    }
                }
            }
        }
    }
    printf("%d", answ);
    return 0;
}

/* practice with Dukkha */
#include <stdio.h>
#include <string.h>

#define N	13

long long lucky(int b) {
	return b == 1 ? 0 : lucky(b / 2) * 10 + (b % 2 == 0 ? 4 : 7);
}

int is_lucky(int y) {
	return y == 0 ? 1 : is_lucky(y / 10) && (y % 10 == 4 || y % 10 == 7);
}

int ff[N];

void init() {
	int i, f;

	f = 1;
	for (i = 0; i < N; i++) {
		ff[i] = f;
		f *= i + 1;
	}
}

int get(int n, int k, int i) {
	static char used[N];
	int h, j;

	memset(used, 0, n * sizeof *used);
	for (h = 0; h < n; h++) {
		int f = ff[n - 1 - h], s = k / f;

		for (j = 0; j < n; j++)
			if (!used[j] && s-- == 0) {
				if (h == i)
					return j;
				used[j] = 1;
				break;
			}
		k %= f;
	}
	return -1;
}

int main() {
	int n, n_, k, b, ans;
	long long f;

	init();
	scanf("%d%d", &n, &k);
	f = 1;
	n_ = 1;
	while (f < k)
		f *= ++n_;
	if (n_ > n) {
		printf("-1\n");
		return 0;
	}
	ans = 0;
	for (b = 2; ; b++) {
		long long x = lucky(b);
		int y;

		if (x > n)
			break;
		if (x <= n - n_) {
			ans++;
			continue;
		}
		y = n - n_ + get(n_, k - 1, x - (n - n_) - 1) + 1;
		if (is_lucky(y))
			ans++;
	}
	printf("%d\n", ans);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#define min(a, b) ((a < b) ? (a) : (b))
#define max(a, b) ((a > b) ? (a) : (b))

int l = 1, r, answ, t = 1;
long long a[11];
long long ans[2048];
int b[13], use[13];
int n, m, k;

int
analyze(void)
{
    int i, nonzero = 0;
    long long tmp = 0;
    for(i = 10; i >= 0; --i){
        if(a[i] == 0 && nonzero){
            return 1;
        }
        tmp = tmp * 10 + a[i];
        if (a[i] != 0){
            nonzero = 1;
        }
    }
    if(tmp >= r){
        ans[n++] = tmp;
        return 0;
    }
    if(tmp >= l){
        ans[n++] = tmp;
    }
    return 1;
}

void
go(int i)
{
    if(!t){
        return;
    }
    if (i == -1){
        t = analyze();
        return;
    }
    a[i] = 0;
    go(i - 1);
    a[i] = 4;
    go(i - 1);
    a[i] = 7;
    go(i - 1);
}

void
gen(int n, int p, int k){
if(p > 0){
    int i, ans = 1;
    for(i = 1; i <= p - 1; ++i){
        ans *= i;
    }
    int tmp = k / ans;
    if(k % ans == 0){
        --tmp;
    }
    for(i = 0; ; ++i){
        if(use[i] == 0){
            if(tmp > 0){
                --tmp;
            } else {
                use[i] = 1;
                b[n - p] = i;
                break;
            }
        }
    }
    gen(n, p - 1, k % ans ? k % ans : ans);
}
}

int
main(void)
{
    scanf("%d%d", &m, &k);
    r = m;
    go(10);
    answ = 0;
    int i, j, q;
    for(i = 0; ans[i] <= m - 13; ++i){
        ++answ;
    }
    gen(min(13, m), min(13, m), k);
    for(i = 0; i < min(13, m); ++i){
        b[i] += max(1, m - 12);
    }
    for(i = max(1, m - 12); i <= m; ++i){
        for(j = 0; j < n; ++j){
            if(ans[j] == i){
                for(q = 0; q < n; ++q){
                    if(b[i - max(1, m - 12)] == ans[q]){
                        ++ answ;
                    }
                }
            }
        }
    }
    printf("%d", answ);
    return 0;
}


#include<stdio.h>
int main()
{
int b,c=0,d,i,j=0,n,k;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(c<a[i])
c=a[i];

j=j+a[i];
}
while(1)
{
i=c*n;
k=i-j;
if(k>j)
break;

c++;
}

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

#include<stdio.h>
int main()
{
    int n,i,j;
    scanf("%d",&n);
    int a[n],max=0,sum=0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum=sum+a[i];
        if(max>=a[i])
        {
            continue;
        }
        else
        {
            max=a[i];
        }
    }
    for(i=max;;i++)
    {
        int sum1=0;
        for(j=0;j<n;j++)
        {
            sum1=sum1+i-a[j];
        }
        if(sum1>sum)
        {
            printf("%d",i);
            break;
        }
        else
        {
            continue;
        }
    }
    return 0;
}

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

int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	int arr[n];
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&arr[i]);
	}
	int max = arr[0];
	int total = 0;
	for (int i = 0; i < n; ++i)
	{
		if(arr[i] > max)
		{
			max = arr[i];
		}
		total += arr[i];
	}
	int total_other = 0 ;
	for (int i = 0; i < n; ++i)
	{
		total_other+= max - arr[i];
	}

	//printf("%d %d\n",total,total_other);
	if (total_other > total)
	{
		printf("%d",max);
	}
	else
	{
		if ((total - total_other) % n == 0)
		{
			printf("%d", (total - total_other)/n + 1 + max);
		}
		else
		{
			printf("%d", (total - total_other)/n + 1 + max);
		}
	}
	return 0;
}

#include <stdio.h>
int main(void)
{
    int n, ara1[101], ara2[101], max, sum1 = 0, sum2, i;
    scanf("%d", &n);
    for(i = 0; i < n; i++)
    {
        scanf("%d", &ara1[i]);

        sum1 = sum1 + ara1[i];
    }
    max = ara1[0];
    for(i = 1; i < n; i++)
    {
        if(ara1[i] > max)
            max = ara1[i];
    }

    efthe:
        for(i = 0, sum2 = 0; i < n; i++)
        {
            ara2[i] = max - ara1[i];
            sum2 = sum2 + ara2[i];
        }
        if(sum2 <= sum1)
        {
            max++;
            goto efthe;
        }
        else
            printf("%d\n", max);

        return 0;
}

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

#include <stdio.h>

int main()
{
    int n,i,sum=0,k,a[100],max=-9,sum1=0,z;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]>max)
        {
            max=a[i];
        }
    }
    for(i=0;i<n;i++)
    {
        sum=sum+a[i];
    }

    z:
     sum1=0;
    for(i=0;i<n;i++)
    {
        sum1=sum1+max-a[i];
    }

       if(sum1>sum)
       {
           printf("%d",max);
       }
       else
       {
           max++;
           goto z;
       }

    return 0;
}

#include <stdio.h>
int main()
{
	int n, s=0;
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int max= a[0];
	for(int i=0;i<n;i++)
	{
		s=s+a[i];
		if(a[i]>max) max=a[i];
	}
//	printf("%d %d",s,max);
	int s1=0,b=max;
	for(int i=0;i<n;i++)
	{
		s1=s1+max-a[i];
	}
	int s2;
	while(s1<=s)
	{
		b++;
		s2=0;
		for(int i=0;i<n;i++)
		{
			s2=s2+b-a[i];
		}
		s1=s2;
	}
	//if(b>5)b=b+1;
	printf("%d",b);
	return 0;
}

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

    }
    while(k<=100000)
    {
        if(n*k-sum>sum)
        {
        printf("%d",k);
        break;
        }
        else
        k++;
    }
    return 0;
}

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

int main()
{
    int cpy,n,k,my_votes=0,opp_votes,tmp,mx;
    scanf("%d",&n);
    scanf("%d",&tmp);
    mx=tmp;
    opp_votes=tmp;
    cpy=n;
    while(cpy>1)
    {
        scanf("%d",&tmp);
        opp_votes+=tmp;
        if(mx<tmp)
            mx=tmp;
        cpy--;
    }
    k=mx;
    while(my_votes<=opp_votes)
    {
        my_votes=(k*n)-opp_votes;
        k++;
    }
    printf("%d",k-1);
    return 0;
}

#include<stdio.h>

int main()
{
    int n;
    scanf("%d",&n);
    int ar[n],sum=0,summ=0,k=0,f=0;
    for(int i=0;i<n;i++)
    {
    scanf("%d",&ar[i]);
    sum+=ar[i];
    if(ar[i]>k)
    k=ar[i];
    }
   // printf("%d %d",k,sum);

    for(int i=k;f==0;i++)
    {
    summ=0;
    for(int j=0;j<n;j++)
    summ+=i-ar[j];
    if(summ>sum)
    {
    printf("%d",i);
    f=1;
    }
    }

    return 0;
}

#include<stdio.h>
int main()
{
  int n,i;
  scanf("%d",&n);
  int a[n],h=0,s=0;
  for(i=0;i<n;i++)
  {
    scanf("%d",&a[i]);
    if(h<a[i])
      h=a[i];
    s+=a[i];
  }
  int avg=s/n;
  int ans=(avg+1)*n;
  ans=(s+ans)/n;
  while(ans*n<=2*s)
    ans++;
  if(ans<h)
    ans=h;
  printf("%d\n",ans);
}

#include<stdio.h>

int main()
{
	int n,i;
	int sum = 0;
	int ans = 0;
	int max = 0;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
		if(max <= a[i])
			max = a[i];
	}
	sum = sum*2;

	ans = sum/n;
	//if(sum%n == 0)
	//	ans = ans;
	//else
		ans+=1;
	if(ans<=max)
		ans = max;
	printf("%d\n",ans);

	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
  int n,s,max;
  scanf("%d",&n);
  int array[n];
  for(int i=0;i<n;i++)
    {
    	scanf("%d",&array[i]);
    	s+=array[i];
	}
	max=array[0];
   for(int i=1;i<n;i++)
	{

		if(max<array[i])
		{
			max=array[i];
		}
	}
	if(max<2*s/n+1)
	{
    	printf("%d",2*s/n+1);
    }
    else printf("%d",max);

}

#include<stdio.h>
int main(){
    unsigned long int n,sum,max,i,num,k;
    scanf("%lu",&n);
    scanf("%lu",&sum);
    max=sum;
    for(i=0;i<n-1;i++) {
        scanf("%lu",&num);
        sum=sum+num;
        if(max<num) max=num;
    }    k=(2*sum/n)+1;
    if(max>k) printf("%lu",max);
    else printf("%lu",k);
    return 0;
}

#include <stdio.h>

int main() {
	int n, k, a, m = 0;
	scanf("%d", &n);
	k = n;

	int arr[n];
	int sum = 0;
	int sum1 = 0;

	for(int i = 0; i < n; i++) {
		scanf("%d", &a);
		arr[i] = a;
		sum += a;
		if(a > m)m = a;
	}

	for(int i = 0; i < n; i++) {
		sum1 += (m - arr[i]);
	}

	while(sum1 <= sum) {
		m++;
		sum1+=n;
	}

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

	return 0;
}

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

int main(){
    int n,mx=0,i,tmp,sum=0,k;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&tmp);
        if(tmp>mx)mx=tmp;
        sum+=tmp;
    }
    sum*=2;
    if((sum%n)==0)k=sum/n;
    else k=(sum/n)+1;
    if((n*k)==sum)k++;
    if(k<mx)printf("%d",mx);
    else printf("%d",k);
    return 0;

}

#include<stdio.h>
int main()
{
          int n,i,sum1=0,sum2=0,a[100],max,j,b[100];
          scanf("%d",&n);
          for(i=0;i<n;i++)
          {
                    scanf("%d",&a[i]);
                    sum1+=a[i];
          }
          max = a[0];
          for(i=1;i<n;i++)
          {
                    if(max<a[i])max = a[i];
          }
          while(1){
                    sum2=0;
          for(i=0;i<n;i++)
          {
                    b[i] = max - a[i];
                    sum2+=b[i];
          }
                if(sum2>sum1)break;
                else max++;
          }
          printf("%d\n",max);
}

#include<stdio.h>

int main(){
	int test;
	int tcase[100];
	int k = 0;
	int total = 0;
	int totalA = 0;

	scanf("%d" , &test);
	getchar();
	for(int i = 0; i < test ; i++){
		scanf("%d", &tcase[i] );
		total = total + tcase[i];

		if(tcase[i] > k) k = tcase[i];
	}

	int check = 1;

	do{
		totalA = 0;
		for(int i = 0 ; i< test ; i++){
			totalA += (k-tcase[i]);
		}
		if(totalA <= total){
			k++;
		}
		else check = 2;
	}while(check == 1);

	printf("%d" , k);

	return 0;
}

#include<stdio.h>
int main(){
	int n,i,a,max=0,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(max<a)max=a;
		sum+=a;
	}
	printf("%d",(2*sum)/n+1<max?max:(2*sum)/n+1);
}

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

int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	int arr[n];
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&arr[i]);
	}
	int max = arr[0];
	int total = 0;
	for (int i = 0; i < n; ++i)
	{
		if(arr[i] > max)
		{
			max = arr[i];
		}
		total += arr[i];
	}
	int total_other = 0 ;
	for (int i = 0; i < n; ++i)
	{
		total_other+= max - arr[i];
	}

	//printf("%d %d\n",total,total_other);
	if (total_other > total)
	{
		printf("%d",max);
	}
	else
	{
		if ((total - total_other) % n == 0)
		{
			printf("%d", (total - total_other)/n +1 + max);
		}
		else
		{
			printf("%d", (total - total_other)/n + 1 + max);
		}
	}
	return 0;
}

#include<stdio.h>
int main()
{
int i,j,s=0,s1=0,n,max;
scanf("%d",&n);
int ara[n];
for(i=0;i<n;i++)
{
	scanf("%d",&ara[i]);
	s=s+ara[i];
}
max=ara[0];
for(i=1;i<n;i++)
{
	if(max<ara[i])
	max=ara[i];
}
while(1)
{
	for(i=0;i<n;i++)
	s1=s1+max-ara[i];
	if(s1>s)
	{
		printf("%d",max);
		break;
	}
	else
	max++;
	s1=0;
}
}

#include<stdio.h>
int main()
{
    int n,a[101],i=0,Awr=0,l=0,Elo=0;
    scanf("%d",&n);
    while(i!=n)
    {
        scanf("%d",&a[i]);
        if(a[i]>l)
            l=a[i];
        Elo+=a[i];
        i++;
    }
    while(1)
    {
        Awr=0;
        for(i=0; i<n; i++)
        {
            Awr+=(l-a[i]);
        }
        if(Awr>Elo)
        {
            printf("%d\n",l);
            break;
        }
        l++;
    }
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n,a[100],sum=0,i,grt=0,sum1;
    scanf("%d",&n);

    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(grt<a[i])
        {
            grt=a[i];
        }
        sum+=a[i];
    }
    b:
        sum1=0;
    for(i=0;i<n;i++)
    {
        sum1=sum1+(grt-a[i]);
    }
    if(sum1<=sum)
    {
       grt++;

        goto b;
    }
    else
    {
        printf("%d",grt);
    }

return 0;
}

#include<stdio.h>

int main(){
    int n, i, sum=0, k, res, max=0;
    scanf("%d", &n);
    int a[n];
    for(i=1; i<=n; i++){
        scanf("%d", &a[i]);
        sum+=a[i];
        if(max < a[i]) max=a[i];
    }
    k=(2*sum)/n+1;

    if(max > k) res=max;
    else res=k;

    printf("%d", res);

    return 0;
}

#include<stdio.h>
int main(void)
{
    int i,j=0,n;
    scanf("%d",&n);
    int max1,max=0,base,need=0,sum=0,array[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&array[i]);
        sum+=array[i];
        if(max<array[i])
            max=array[i];
    }
    if((sum*2+1)%n!=0)
        base=(2*sum+1)/n+1;
    else
        base=(2*sum+1)/n;
    max1=max>base?max:base;
    while(need<=sum)
    {
        max1+=j;
        for(i=0,need=0;i<n;i++)
        {
            need+=(max1-array[i]);
        }
        j++;
    }
    if(j>1)
        max1-=1;
    printf("%d\n",max1);
    return 0;
}

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

int main()
{
    int n, s, m, i, x;

    scanf("%d", &n);

    m=0;
    s=0;

    for(i=0; i<n; i++)
    {
        scanf("%d", &x);
        if(m<x)m=x;
        s+=x;
    }

    while(m*n-s<=s)m++;

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

#include <stdio.h>

int studnum,elro[100],sum,max;

int main ()
{
	//freopen ("cf.in","r",stdin),freopen("cf.out","w",stdout);
	scanf ("%d",&studnum);
	for (int i=0;i<studnum;i++)
	{
		scanf ("%d",&elro[i]);
		sum += elro[i];
		if (max < elro[i]) max = elro[i];
	}
	for (int i=1;1;i++)
	{
		if (i*studnum-sum>sum)
			{
				printf("%d\n",i < max ? max : i);
				break;
			}
	}
}

#include<stdio.h>
int main()
{
   int n,temp=-10;
   int sum=0,vote=0;
   int i,j,k;
   scanf("%d",&n);
   int a[n];
   for(i=0; i<n; i++){
      scanf("%d",&a[i]);
      sum=sum+a[i];
      if(a[i]>temp){
         temp=a[i];
      }
   }
   vote=2*sum;
   vote=(vote/n)+1;
   if(temp>vote){
     printf("%d",temp);
   }
   else{
     printf("%d",vote);
   }

   return 0;
}

#include<stdio.h>
int main()
{
    long long int n,i,temp=0;
    scanf("%lld",&n);
    long long int a[n],t=0,k=0,j,p[n];
    for(i=0;i<n;i++)
        {scanf("%lld",&a[i]);
        p[i]=0;
        p[i]=a[i];
        t=t+a[i];
}
for(i=0;i<n-1;i++)
{
    temp=p[i]>p[i+1]?p[i]:p[i+1];
    p[i+1]=temp;
}
for(i=0;;i++)
{
    for(j=0;j<n;j++)
    {k=k+(temp-a[j]);
    }
    if(k>t)
    {
        printf("%lld",temp);
        break;
    }
    else
        {
            temp=temp+1;
            k=0;
        }
}
return 0;
}

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

int main()
{
    int n,i,k,s=0;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        s=s+a[i];
        if(i==0)
        {
            k=a[0];
        }
        else
        {
            if(a[i]>k)
            {
                k=a[i];
            }
        }
    }
    while(n*k - s <= s)
    {
        k++;
    }
    printf("%d",k);
    return 0;
}

#include <stdio.h>

int main() {
	int n;
	scanf(" %d", &n);
	int arr[n], sum=0, max=0;
	for (int i=0;i<n;i++) {
		scanf(" %d", &arr[i]);
		sum+=arr[i];
		if (arr[i]>max) max=arr[i];
	}
	int sumb=0;
	for (max;sumb<sum;max++) {
		sumb=0;
		for (int i=0;i<n;i++) {
			sumb+=max-arr[i];
		}
		if (sumb>sum) break;
	}
	printf("%d\n", max);
	return 0;
}

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

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

            p=n*i;

            l=(p-sum);

            if(l>sum)

            break;
        }
        printf("%d",i);
    }
    return 0;
}

#include<stdio.h>
int main()
{
	int n,sum=0,sum2=0,temp,i;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int max=a[0];
	for(i=0;i<n;i++)
	{
		sum=sum+a[i];
	}
	for(i=1;i<n;i++)
	{
		if(a[i]>max)
		{
			max=a[i];
		}
	}
	temp=max;
	sum2=0;
	while(sum2<=sum)
	{
	    sum2=0;
		for(i=0;i<n;i++)
		{
		    sum2=sum2+temp-a[i];
		}
	    if(sum2>sum)
	    {
	        break;
	    }
	    else
	    {
	        temp=temp+1;
	    }
	}

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

#include<stdio.h>
int main()
{
    int n,k,i;
    int students[100];
    int Awruk=0,Elodreip=0;

    //input
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&students[i]);
    }
    //biggest vote
    int biggest_vote=students[0];
    for(i=0;i<n;i++){
        if(students[i]>biggest_vote){
            biggest_vote=students[i];
        }
    }

    //main objective;
    for(k=biggest_vote;k<202;k++){
        for(i=0;i<n;i++){
            Elodreip=Elodreip+students[i];
            Awruk=Awruk+(k-students[i]);
        }
        if(Awruk>Elodreip)break;
        Awruk=0,Elodreip=0;
    }
    printf("%d\n",k);
    //
}

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

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

int main()
{
   int n, i, x[110], y, z;

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

   h:
   if(((y*n)-z)>z)
    printf("%d", y);
   else
   {
       y = y+1;
       goto h;
   }
}

#include<stdio.h>
int main()
{
    int n,i,a[10000],sum=0,max=0,j,newsum=0,x,y;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
        if(a[i]>max)
        {
            max=a[i];
        }
    }
    for(i=0;i<n;i++)
    {
        newsum+=(max-a[i]);
    }
    if(newsum>sum)
    {
        printf("%d\n",max);
        return 0;
    }
    else
    {
        x=(((sum+1)-newsum)/n);
        y=x*n;
                if(y==(sum-newsum+1))
        {
            printf("%d\n",max+x);
            return 0;
        }
        else if(y!=(sum-newsum+1)){
            printf("%d\n",max+x+1);return 0;}
    }

    return 0;
}

#include<stdio.h>
int main()
{
    int n,a,max=0,sum=0,i,D,n1;
    scanf("%d",&n);
    n1=n;
    while(n--)
    {
        scanf("%d",&a);
        if(a>=max) max=a;
        sum=sum+a;
    }
    //printf("%d %d\n",sum,max);
    for(i=max;;i++)
    {
        D=(n1*i)-sum;
        if(D>sum) break;
        else continue;
    }
    printf("%d",i);
    return 0;
}

#include<stdio.h>

int main()
{
  int n,i,a[100],sum=0,t,max=0;

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

  while(1)
 {
   t=max*n;
  if(sum<t-sum)
  {
   printf("%d",max);exit(0);
  }
  else max++;

  }

}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}
long long int minx(long long int x,long long int y){
    if(x>y){
        return y;
    }else{
        return x;
    }
}
long long int maxx(long long int x,long long int y){
    if(x<y){
        return y;
    }else{
        return x;
    }
}
int main(){

long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,k,sum2,min,f,r,o,sum1,sum=0,y,b,count1, a1[1000000]={0};
char a[100000];
scanf("%lld",&n);
max=0;
for(i=1;i<=n;i++){
    scanf("%lld",&x);
    sum+=x;
    if(x>=max){
        max=x;
    }
}
for(i=max;;i++){
    m=i*n;
    r=m-sum;
    if(r>sum){
        printf("%lld",i);
        return 0;
    }
}
return 0;
}

#include <stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
int main()
{
//	freopen("test.txt", "r", stdin);
    int n;
    scanf("%d", &n);
    int d[n], maxv = 0, enemy = 0;
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &d[i]);
        maxv = max(maxv, d[i]);
        enemy += d[i];
    }
    int sum = 0;
    for(int i = 0; i < n; i++)
        sum += maxv - d[i];
    int i = maxv;
    while(i <= 20000)
    {
        if(sum > enemy)
        {
            printf("%d\n", i);
            return 0;
        }
        sum += n;
        i++;
    }
}

#include<stdio.h>

int main() {
    int n, k, m = 0, a = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int v;
        scanf("%d", &v);
        a+= v;
        if (m < v) m = v;
    }
    k = m;
    while (k*n - 2*a <= 0) k++;
    printf("%d", k);
    return 0;
}

#include<stdio.h>

int main()
{
    unsigned int n,i,k,max_num=0,opn_vote=0;
    scanf("%d",&n);
    int b[n];
    for(i=0;i<n;i++){
        scanf("%d",&b[i]);
    }
     for(i=0;i<n;i++){
        if(max_num<b[i]){
            max_num=b[i];
        }
    }

    for(i=0;i<n;i++){
        opn_vote=opn_vote+b[i];
    }
    double result=opn_vote;
    k=((2*result)/n);
    if(k<max_num){
        printf("%d",max_num);
    }
    else{
    printf("%d",(k+1));
    }
    return 0;
}

#include "stdio.h"
int findMax(int a[],int num)
{
	int i,max=a[0];
	for(i=1;i<num;i++)
		if(a[i]>max)
			max = a[i];
	return max;
}
int main()
{
	int n,k,i,a[100];
	int vote_A=0,vote_E=0;
//	freopen("data.txt","r",stdin);
//	freopen("result.txt","w",stdout);
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		vote_E += a[i];
	}
//	printf("vote_E = %d\n",vote_E);
	k = findMax(a,n);
	while(1)
	{
		vote_A = 0;
		for(i=0;i<n;i++)
			vote_A += k-a[i];
//		printf("k= %d  vote_A = %d\n",k,vote_A)		;
		if(vote_A>vote_E)
		{
			printf("%d",k);
			break;
		}
		else
			k++;
	}
	return 0;
}

#include <stdio.h>
int max(int a,int b){if(a>b) return a; else return b;}
int main (){
int i,n,sum = 0;
int ans,mx = -1;
scanf("%i",&n);
for (i=0;i<n;i++){
	int f;
	scanf("%i",&f);
	sum += f;
	mx = max (mx,f);
	}
ans = mx;
if( n*ans - sum <= sum ){
	ans += (2*sum - n*ans + n - 1) / n;
}
if (n*ans == 2*sum)
	ans++;
printf ("%i",ans);
return 0-0-0;
}

#include<stdio.h>
int main()
{
    int n,i,j,max=0,total=0,k;
    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=a[i];
        }
    }

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

    for(j=max;;)
    {
        k=n*j-total;
        if(k>total)
        {
            printf("%d\n",j);
            break;
        }
        j++;
    }
    return 0;
}

#include<stdio.h>
int main(){
    int n ;
    scanf("%d",&n);
    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 = max ; i <= 201 ; i ++)
    {
        if(i*n - total > total){
            printf("%d",i);
            return 0;
        }
    }
}

#include<stdio.h>
int main()
{
    int a,b[101],d=0,i,f=0,j;
    scanf("%d",&a);
    for(i=0;i<a;i++)
    {
        scanf("%d",&b[i]);
        d=d+b[i];
        if(b[i]>f)
            f=b[i];
    }
    for(i=f;;i++)
    {
        int cnt = 0;
        for(j=0;j<a;j++)
            cnt+=i-b[j];
        if(cnt>d){
            printf("%d\n", i);
            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];
	}
	int cek = 1;
	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 = 0;
		}
	}
	printf("%d", max);

	return 0;
}

#include<stdio.h>
int main()
{
    int i,j,max=-2,n,ara[1011],sum=0,k=0,elo_total=0,m;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&ara[i]);
        elo_total=elo_total+ara[i];
    }
    //printf("elo tot:%d\n",elo_total);
    for(i=1;i<=n;i++)
    {
        if(ara[i]>max)
        {
            max=ara[i];
        }
    }
    //printf("max:%d\n",max);
    for(i=1,j=max;i<=n;i++)
    {
        sum=j-ara[i];
        k=k+sum;
        if(i==n)
        {
            if(k>elo_total)
            {
                printf("%d",j);
                break;
            }
            else
            {
                i=0;
                j++;
                k=0;
                sum=0;
            }
        }
    }
}

#include<stdio.h>   //AA06( 09/ 04/ 20) If u see my code, Have a Good Day!

int main()
{
    int n, a[150], i, sum = 0, max, ans;

    scanf("%d", &n);

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

    max = a[0];

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

    for(i = 0; ; i++) {
        if(((max * n) - sum) > sum) {
            ans = max;
            break;
        }
        else{
            max++;
        }

    }

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

    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<math.h>
int main()
{
    int n,*a,i,max=0,sum=0,x,ans,res=0,sum1=0;
    scanf("%d",&n);
    a=(int *)malloc(sizeof(int)*n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);

        sum1+=a[i];

        if(a[i]>max)
        {
            max=a[i];
        }
    }

    sum=sum1;
    sum=sum*2;

    x=sum/n;

    if(sum%n!=0)
    {
        x+=1;
    }

    if(x>=max)
    {
        ans=x;
    }

    else
    {
        ans=max;
    }

    for(i=0;i<n;i++)
    {
        a[i]=ans-a[i];
        res+=a[i];
    }

    if(res==sum1)
    {
        ans+=1;
    }
    printf("%d",ans);
}

#include <stdio.h>

void swap(int *a,int *b){
	int temp=*a;
	*a=*b;
	*b=temp;
}

void Sort(int *arr,int m){
	for (int i=0;i<m;i++){
		for (int j=0;j<m-1-i;j++){
			if (arr[j]<arr[j+1]){
				swap(&arr[j],&arr[j+1]);
			}
		}
	}
}

int main()
{
	int people;
	int forEle[1005];

	scanf ("%d",&people);

	int sumele=0;
	for (int i=0;i<people;i++){
		scanf ("%d",&forEle[i]);
		sumele+=forEle[i];
	}

	Sort(forEle,people);

	int k=forEle[0];
	for (int i=k;i<=300;i++){
		int sumAW=0;
		for (int j=0;j<people;j++){
			sumAW+=(i-forEle[j]);
		}
		if (sumAW>sumele){
			printf ("%d\n",i);
			break;
		}
	}

	return 0;
}

#include<stdio.h>
#include<math.h>
int main() {
    int n,i;
    scanf("%d",&n);
    float a[100],sum=0,max=0,val,temp;
    for(i=0;i<n;i++) {
        scanf("%f",&a[i]);
        sum += a[i];
        if(a[i]>max) max=a[i];
    }
    val=sum*2/n;
    temp=ceil(val);
    if(val==temp){
      val=temp+1;
    }
    else val=temp;
    if(val>max) printf("%d",(int)val);
    else printf("%d",(int)max);
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,i,sum=0,t,max=0,min;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&t);
        if(t>max) max=t;
        sum =sum+t;

    }
    //printf("%d\n",sum);
     min=(ceil)(((2*sum)+1)*1.0/(n));
     //printf("%d\n",sum);
     if(min<max)
     {
         printf("%d",max);
     }
     else
     {
         printf("%d",min);
     }

}

#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",k);
    return 0;
}

#include<stdio.h>
int main(){
    unsigned long int n,sum,max,i,num,k;
    scanf("%lu",&n);
    scanf("%lu",&sum);
    max=sum;
    for(i=0;i<n-1;i++) {
        scanf("%lu",&num);
        sum=sum+num;
        if(max<num) max=num;
    }  if(2*sum%n==0)  {k=2*sum/n;}
      else  {k=(2*sum/n)+1;}
    if(max>k) printf("%lu",max);
    else printf("%lu",k);
    return 0;
}

#include<stdio.h>

int main()
{
	int n;
	scanf("%d", &n);
	int a[n],flag=0,count,b[n];
	for(int i=0;i<n;i++)
	{
		scanf("%d", &a[i]);
		flag=flag+a[i];
	}
	int max=a[0];
	for(int i=1;i<n;i++)
	{
		if(max<a[i])
		max=a[i];
	}
	for(int i=max;i<=100;i++)
	{
		count=0;
		for(int j=0;j<n;j++)
		{
			b[j]=i-a[j];
			count=count+b[j];
		}

		if(count>flag)
		{
			printf("%d\n", i);
			break;
		}

	}
	return 0;
}

#include<stdio.h>
int main()
{
    int n,i,j,max=0,total=0,k;
    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=a[i];
        }
    }
     printf("%d\n",max);
    for(i=0;i<n;i++)
    {
        total=total+a[i];
    }
    printf("%d\n",total);
    for(j=max;;)
    {
        k=n*j-total;
        if(k>total)
        {
            printf("%d\n",j);
            break;
        }
        j++;
    }
    return 0;
}

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

int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    int max = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > max) {
            max = a[i];
        }
    }
    for (int k = max; k < max*2+1; k++) {
        int q1 = 0, q2 = 0;
        for (int i = 0; i < n; i++) {
            q1 += a[i];
            q2 += k - a[i];
        }
        if (q2 > q1) {
            printf("%d\n", k);
            return 0;
        }
    }

}

#include <stdio.h>

int main() {
	int n, k, a, m = 0;
	scanf("%d", &n);
	k = n;

	int arr[n];
	int sum = 0;
	int sum1 = 0;

	for(int i = 0; i < n; i++) {
		scanf("%d", &a);
		arr[i] = a;
		sum += a;
		if(a > m)m = a;
	}

	for(int i = 0; i < n; i++) {
		sum1 += (m - arr[i]);
	}

	while(sum1 < sum) {
		m++;
		sum1+=n;
	}

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

	return 0;
}

#include <stdio.h>

void swap(int *a,int *b){
	int temp=*a;
	*a=*b;
	*b=temp;
}

void Sort(int *arr,int m){
	for (int i=0;i<m;i++){
		for (int j=0;j<m-1-i;j++){
			if (arr[j]<arr[j+1]){
				swap(&arr[j],&arr[j+1]);
			}
		}
	}
}

int main()
{
	int people;
	int forEle[1005];

	scanf ("%d",&people);

	int sumele=0;
	for (int i=0;i<people;i++){
		scanf ("%d",&forEle[i]);
		sumele+=forEle[i];
	}

	Sort(forEle,people);

	int k=forEle[0];
	for (int i=k;i<=100;i++){
		int sumAW=0;
		for (int j=0;j<people;j++){
			sumAW+=(i-forEle[j]);
		}
		if (sumAW>sumele){
			printf ("%d\n",i);
			break;
		}
	}

	return 0;
}

#include<stdio.h>
int main()
{
    long long int n,i,temp=0;
    scanf("%lld",&n);
    long long int a[n],t=0,k=0,j;
    for(i=0;i<n;i++)
        {scanf("%lld",&a[i]);
        t=t+a[i];
}
for(i=0;i<n-1;i++)
{
    temp=a[i]>a[i+1]?a[i]:a[i+1];
    a[i+1]=temp;
}
for(i=0;;i++)
{
    for(j=0;j<n;j++)
    {
        k=k+(temp-a[j]);
    }
    if(k>t)
    {
        printf("%lld",temp);
        break;
    }
    else
        {temp++;
        k=0;
        }
}
return 0;
}

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

    int n,v,max,sum=0,wv=0,sum2=0,count=0;

    scanf("%d",&n);
    int a[n];

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

     }
     if(n==1){

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

  }
  else if(n>1){

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

    while(1){

        for(int i=0;i<n;i++){
       wv=max-a[i];
       sum2=sum2+wv;

     }
     if(sum2>sum){
        printf("%d\n",max);
        break;
     }
     else{

        max=max+1;
        sum2=0,wv=0;
         count--;
     }

     }

  }

return 0;}

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

#include<stdio.h>
int main()
{
    int n,i,c=0;
    scanf("%d",&n);
    int a[n],sum1=0,sum2=0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum1+=a[i];
    }
    int b=sum1/2;
    for(i=0;i<n;i++){
        sum2+=(b-a[i]);
        if(b<a[i])
          c++;
    }

    if(sum2>sum1&&c==0)
        printf("%d\n",b);
    else
        printf("%d\n",b+1);
}

#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    int i, k, j, largest, m, sum1=0, sum2;
    int a[100];
    for (i=0; i<n; i++)
    {
        scanf("%d", &a[i]);
        sum1 = sum1+a[i];
    }

    if (n==1)
    {
        largest = a[0];
    }

    else if (n==2)
    {
        if (a[0]>a[1])
        {
            largest = a[0];
        }

        else
        {
            largest = a[1];
        }
    }

    else
    {
        for (j=0; j<i; j++) //finding the largest num
        {
            if (a[j]>=a[j+1])
            {
                largest = a[j];
            }

            else
            {
                continue;
            }
        }
    }

    for (m=0; m<=101; m++)
    {
        k = largest+m;
        sum2 = (n*k) - sum1;
        if (sum2 > sum1)
        {
            break;
        }
    }

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

    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]);
        score=score+a[i];
        if(a[i]>k)
        {
            k=a[i];
        }
    }
    int high;
    for(i=k;i<=100;i++)
    {
        high=k*n;
        if(score<=((high-1)/2))
        {
            break;
        }
        else
        {
            ++k;
        }
    }
    printf("%d",k+1);
    return 0;
}

#include <stdio.h>
int a[101],b[101];
int main()
{
    int n,i=0,j,el=0,aw=0;
    scanf("%d",&n);
    for(i=1,j=1;i<=n,j<=n;i++,j++)

    {
        scanf("%d",&a[i]);
        el=el+a[i];
        b[j]=n-a[i];
        aw=aw+b[j];
    }
    int k=1,l=0;
    //printf("%d %d\n",el ,aw);
    if(aw>el)
        {
            while(i++)
            {
               if(aw-n<el || aw-n==el)
               {

                   int ans=n-l;
                   printf("%d\n",ans);
                   break;
               }
                /*if(aw-n<el)
               {

                   int ans=n-l;
                   printf("%d\n",ans);
                   break;
               }*/
               else

               {
               aw=aw-n;
               l++;
            }
            }
        }

    else
    {

        while(k++)
        {

            if(aw+n*k>el)
            {
                printf("%d\n",n+k);
                break;
            }
            //else
              //  k++;
        }

    }
    return 0;

}

#include <stdio.h>
int main()
{
	int n, s=0;
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int max= a[0];
	for(int i=0;i<n;i++)
	{
		s=s+a[i];
		if(a[i]>max) max=a[i];
	}
//	printf("%d %d",s,max);
	int s1=0,b=max;
	for(int i=0;i<n;i++)
	{
		s1=s1+max-a[i];
	}
	int s2=s1;
	while(s2<s)
	{
		//	b++;
		for(int i=0;i<n;i++)
		{
			s2=s2+b-a[i];
		}
		b++;
	}
//	if(b>5)b=b+1;
	printf("%d",b);
	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]);
        score=score+a[i];
        if(a[i]>k)
        {
            k=a[i];
        }
    }
    int high=k*n;
    for(i=k;i<=100;i++)
    {
        if(score<=((high-1)/2))
        {
            break;
        }
        else
        {
            ++k;
        }
    }
    printf("%d",k);
    return 0;
}

#include<stdio.h>
int main(void)
{
    int i,j=0,n;
    scanf("%d",&n);
    int max1,max=0,base,need=0,sum=0,array[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&array[i]);
        sum+=array[i];
        if(max<array[i])
            max=array[i];
    }
    if(sum%n!=0)
        base=sum/n+1;
    else
        base=sum/n;
    max1=max>base?max:base;
    while(need<=sum)
    {
        max1+=j;
        for(i=0,need=0;i<n;i++)
        {
            need+=(max1-array[i]);
        }
        j++;
    }
    if(j>1)
        max1-=1;
    printf("%d\n",max1);
    return 0;
}

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

int main()
{
    int m,k,j,max,total=0,awk=0;
    scanf("%d", &m);
    int vote[m];
    for(j=0;j<m;j++)
    {
        scanf("%d", &vote[j]);
        if(!j)
            max=vote[j];
        else
        {
            if(max<vote[j])
                max=vote[j];
        }
        total+=vote[j];
    }

    k=max;
    for(j=0;j<m;j++)
    {
        awk+=k-vote[j];
    }
    if(awk>total)
        printf("%d", k);
    else
    {
        int ch;
        ch=(total-k)/m;
        printf("%d", k+ch+1);
    }

    return 0;
}

//       In the name of         ˜”*°•.˜”*°•                      God                     •°*”˜.•°*”˜

/*

            JadedBeast                                             ~~Morocco~~

*/
#include <stdio.h>

int main(void){
    int n,sum=0,a,k=1;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        sum+=a;
    }
    while(n*k-sum<(n*n)/2){
        k++;
    }
    printf("%d",k);
    return 0;
}

#include<stdio.h>
int main()
{
  int n,i;
  scanf("%d",&n);
  int a[n],h=0,s=0;
  for(i=0;i<n;i++)
  {
    scanf("%d",&a[i]);
    if(h<a[i])
      h=a[i];
    s+=a[i];
  }
  int avg=s/n;
  int ans=(avg+1)*n;
  ans=(s+ans)/n;
  //printf("%d %d %d\n",ans,h,s);
  if(ans<h)
    ans=h;
  printf("%d\n",ans);
}

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

}

#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];
	}
	int cek = 1;
	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 = 0;
		}
	}
	printf("%d", max);

	return 0;
}

#include <stdio.h>
int a[101],b[101];
int main()
{
    int n,i,j,el=0,aw=0;
    scanf("%d",&n);
    for(i=1,j=1;i<=n,j<=n;i++,j++)

    {
        scanf("%d",&a[i]);
        el=el+a[i];
        b[j]=n-a[i];
        aw=aw+b[j];
    }
    int k=1;
    //printf("%d %d",el ,aw);
    if(aw>el)
        printf("%d\n",n);

    else
    {
        while(k++)
        {

            if(aw+n*k>el)
            {
                printf("%d\n",n+k);
                break;
            }
            //else
              //  k++;
        }

    }
    return 0;

}

#include<stdio.h>
int main()
{
    int n,i,a[10000],sum=0,max=0,j,newsum=0,x,y;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
        if(a[i]>max)
        {
            max=a[i];
        }
    }
    for(i=0;i<n;i++)
    {
        newsum+=(max-a[i]);
    }
    if(newsum>sum)
    {
        printf("%d\n",max);
        return 0;
    }
    else
    {
        x=(((sum+1)-newsum)/n);
        y=x*n;
                if(y==(sum-newsum+1))
        {
            printf("%d\n",max+x);
            return 0;
        }
        else if(y!=n){
            printf("%d\n",max+x+1);return 0;}
    }

    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]);
        score=score+a[i];
        if(a[i]>k)
        {
            k=a[i];
        }
    }
    int high=k*n;
    for(i=k;i<=100;i++)
    {
        if(score<(high/2))
        {
            break;
        }
        else
        {
            ++k;
        }
    }
    printf("%d",k);
    return 0;
}

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

int max(int a, int b)
{
    return a>b ? a : b;
}

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

    int *a, i, j, count=0, temp;

    a = (int *)malloc(sizeof(int) * n);

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

    temp = a[0];

    for (i=1; i<n; i++)
    {
        temp = max(temp, a[i]);
    }

    int k;

    int ans;

    for (i=0; i<=100; i++)
    {
        k = temp+i;
        if (((n*k)-count)>count)
        {
            ans = k;
            break;
        }
    }

    printf("%d", ans);

    free(a);
    return 0;
}

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

int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	int arr[n];
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&arr[i]);
	}
	int max = arr[0];
	int total = 0;
	for (int i = 0; i < n; ++i)
	{
		if(arr[i] > max)
		{
			max = arr[i];
		}
		total += arr[i];
	}
	int total_other = 0 ;
	for (int i = 0; i < n; ++i)
	{
		total_other+= max - arr[i];
	}

	//printf("%d %d\n",total,total_other);
	if (total_other > total)
	{
		printf("%d",max);
	}
	else
	{
		if ((total - total_other) % n == 0)
		{
			printf("%d", (total - total_other)/n + max);
		}
		else
		{
			printf("%d", (total - total_other)/n + 1 + max);
		}
	}
	return 0;
}

#include<stdio.h>

int main(){
	int test;
	int tcase[100];
	int k = 0;
	int total = 0;
	int totalA = 0;

	scanf("%d" , &test);
	getchar();
	for(int i = 0; i < test ; i++){
		scanf("%d", &tcase[i] );
		total = total + tcase[i];

		if(tcase[i] > k) k = tcase[i];
	}

	int check = 1;

	do{
		for(int i = 0 ; i< test ; i++){
			totalA += (k-tcase[i]);
		}

		if(totalA <= total){
			k++;
		}
		else check = 2;
	}while(check == 1);

	printf("%d" , k);

	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,i,sum=0,t,max=0,min;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&t);
        if(t>max) max=t;
        sum =sum+t;

    }
     min=ceil((2*sum+1)/(n));
     if(min<max)
     {
         printf("%d",max);
     }
     else
     {
         printf("%d",min);
     }

}

#include <stdio.h>
int a[101],b[101];
int main()
{
    int n,i=0,j,el=0,aw=0;
    scanf("%d",&n);
    for(i=1,j=1;i<=n,j<=n;i++,j++)

    {
        scanf("%d",&a[i]);
        el=el+a[i];
        b[j]=n-a[i];
        aw=aw+b[j];
        if(a[i]==n){
            printf("%d",n);
            return 0;
        }
    }
    int k=1,l=0;
    //printf("%d %d\n",el ,aw);
    if(aw>el)
        {
            while(i++)
            {
               if(aw-n<el || aw-n==el)
               {

                   int ans=n-l;
                   printf("%d\n",ans);
                   break;
               }
                /*if(aw-n<el)
               {

                   int ans=n-l;
                   printf("%d\n",ans);
                   break;
               }*/
               else

               {
               aw=aw-n;
               l++;
            }
            }
        }

    else
    {

        while(k++)
        {

            if(aw+n*k>el)
            {
                printf("%d\n",n+k);
                break;
            }
            //else
              //  k++;
        }

    }
    return 0;

}

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

#include <stdio.h>
int a[101],b[101];
int main()
{
    int n,i,j,el=0,aw=0;
    scanf("%d",&n);
    for(i=1,j=1;i<=n,j<=n;i++,j++)

    {
        scanf("%d",&a[i]);
        el=el+a[i];
        b[j]=n-a[i];
        aw=aw+b[j];
    }
    int k=1;
    //printf("%d %d\n",el ,aw);
    if(aw>el)
        {
            if(aw-el<aw)
                printf("%d",n);
            else
            {
                for(i=n;i>=1;i--)
            {
                if(n*i-el<=el)
                {
                    printf("%d\n",i+1);
                    break;
                }
        }
            }
        }

    else
    {

        while(k++)
        {

            if(aw+n*k>el)
            {
                printf("%d\n",n+k);
                break;
            }
            //else
              //  k++;
        }

    }
    return 0;

}

#include<stdio.h>
#include<math.h>
int main() {
    int n,i;
    scanf("%d",&n);
    float a[100],sum=0,max=0,val;
    for(i=0;i<n;i++) {
        scanf("%f",&a[i]);
        sum += a[i];
        if(a[i]>max) max=a[i];
    }
    val=sum*2/n;
    val=ceil(val);
    if(val>max) printf("%d",(int)val);
    else printf("%d",(int)max);
    return 0;
}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[100000]={0};
scanf("%lld",&n);
for(i=0;i<n;i++){
    scanf("%lld",&y);
    a[y]++;
}
max=0;
for(i=0;i<102;i++){
    if(a[i]>max){
        max=i;
    }
}
printf("%lld",((max*2))+1);
return 0;
}

#include<stdio.h>
int main()
{
    int i,j,max=-2,n,ara[1011],sum=0,k=0,elo_total=0,m;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&ara[i]);
        elo_total=elo_total+ara[i];
    }
    printf("elo tot:%d\n",elo_total);
    for(i=1;i<=n;i++)
    {
        if(ara[i]>max)
        {
            max=ara[i];
        }
    }
    printf("max:%d\n",max);
    for(i=1,j=max;i<=n;i++)
    {
        sum=j-ara[i];
        k=k+sum;
        if(i==n)
        {
            if(k>elo_total)
            {
                printf("%d",j);
                break;
            }
            else
            {
                i=0;
                j++;
                k=0;
                sum=0;
            }
        }
    }
}

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

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

#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    int i, k, j, largest, m, sum1=0, sum2;
    int a[100];
    for (i=0; i<n; i++)
    {
        scanf("%d", &a[i]);
        sum1 = sum1+a[i];
    }
    //printf("%d\n", sum1);

    for (j=0; j<i; j++) //finding the largest num
    {
        if (a[j]>=a[j+1])
        {
            largest = a[j];
        }

        else
        {
            continue;
        }
    }
    //printf("%d\n", largest);

    for (m=0; m<=101; m++)
    {
        k = largest+m;
        sum2 = (n*k) - sum1;
        if (sum2 > sum1)
        {
            break;
        }
    }

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

    return 0;
}

#include<stdio.h>
int main()
{
   int n,i,j,sum1=0,sum2=0,max=0;
   scanf("%d",&n);
   int a[n];
   for(i=0;i<n;i++)
   {
       scanf("%d",&a[i]);
       sum1+=a[i];
       if(a[i]>max)
        max=a[i];
   }
   for(i=max;;i++)
   {
       for(j=0;j<n;j++)
        sum2+=i-a[j];
       if(sum2>sum1)
       {
           printf("%d\n",i);break;
       }
   }

}

#include<stdio.h>
int main()
{
    int n,i,j,count=0,count1=0,count2=0,ara[100000];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&ara[i]);
        count1=count1+ara[i];
    }
    for(i=0;i<n;i++)
    {
        if(count<ara[i])
        {
            count=ara[i];
        }
    }
    for(i=count;i<count+100;i++)
    {
        count2=0;
        for(j=0;j<n;j++)
        {
            count2=count2+i-ara[j];
        }
        if(count2>=count1)
        {
            break;
        }
    }
    printf("%d",i);
}

#include<stdio.h>
int main(){
    unsigned long int n,sum,max,i,num,k;
    scanf("%lu",&n);
    scanf("%lu",&sum);
    max=sum;
    for(i=0;i<n-1;i++) {
        scanf("%lu",&num);
        sum=sum+num;
        if(max<num) max=num;
    }  if(2*sum%n==0)  {k=2*sum/n;}
      else  {k=(2*sum/n)+1;}
    if(max>k) printf("%lu",max);
    else printf("%lu",k);
    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]);
        score=score+a[i];
        if(a[i]>k)
        {
            k=a[i];
        }
    }
    int high=k*n;
    for(i=k;i<=100;i++)
    {
        if(score<=(high/2))
        {
            break;
        }
        else
        {
            ++k;
        }
    }
    printf("%d",k);
    return 0;
}

#include<stdio.h>
int main()
{
    int a,n,i,sum=0,max=0,p,k;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a);
        if(max<a)
        max=a;
        sum=sum+a;
    }
    p=max*n;
    k=p-sum;
    if(k>sum)
    printf("%d",max);
    else
    {
        for(i=max+1;;i++)
        {
            p=n*i;

            k=k+p-sum;
            if(k>p)

            break;
        }
        printf("%d",i);
    }
    return 0;
}

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

    }
    while(k<=100)
    {
        if(n*k-sum>sum)
        {
        printf("%d",k);
        break;
        }
        else
        k++;
    }
    return 0;
}

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

}

#include<stdio.h>
#include<math.h>
int main() {
    int n,i;
    scanf("%d",&n);
    float a[100],sum=0,max=0,val;
    for(i=0;i<n;i++) {
        scanf("%f",&a[i]);
        sum += a[i];
        if(a[i]>max) max=a[i];
    }
    val=sum*2/n;
    val=ceil(val);
    if(val>max) printf("%d",(int)val);
    else printf("%d",(int)max);
    return 0;
}

//       In the name of         ˜”*°•.˜”*°•                      God                     •°*”˜.•°*”˜

/*

            JadedBeast                                             ~~Morocco~~

*/
#include <stdio.h>

int main(void){
    int n,sum=0,a,k=1;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        sum+=a;
    }
    while(n*k-sum<(n*n)/2){
        k++;
    }
    printf("%d",k);
    return 0;
}

#include <stdio.h>
int a[101],b[101];
int main()
{
    int n,i,j,el=0,aw=0;
    scanf("%d",&n);
    for(i=1,j=1;i<=n,j<=n;i++,j++)

    {
        scanf("%d",&a[i]);
        el=el+a[i];
        b[j]=n-a[i];
        aw=aw+b[j];
    }
    int k=1;
    //printf("%d %d",el ,aw);
    if(aw>el)
        printf("%d\n",n);

    else
    {
        while(n++)
        {

            if(aw+n*k>el)
            {
                printf("%d\n",n);
                break;
            }
            else
                k++;
        }

    }
    return 0;

}

#include<stdio.h>

int main()
{
    int n, i, j, c=0;

    scanf("%d", &n);
    int a;

    for(i=0 ; i<n ; i++)
    {
        scanf("%d", &a);
        c+=a;
    }
    for(i=1 ; ; i++)
    {
        j=i*i;
        if((j-c)>c) break;
    }
    printf("%d", i);

    return 0;
}

#include<stdio.h>
int main(){
    int n ;
    scanf("%d",&n);
    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>
int main()
{
   int n,i,sum3=0;
   scanf("%d",&n);
   int a[n],max=0,min=101,sum1=0,sum2=0;
   for(i=0;i<n;i++)
   {
       scanf("%d",&a[i]);
       if(a[i]>max)
        max=a[i];
       if(a[i]<min)
        min=a[i];
       sum1+=a[i];
   }
   for(i=0;i<n;i++)
    sum2+=(max-a[i]);
    for(i=0;i<n;i++)
        sum3+=(max+min-a[i]);
    if(sum2>sum1)
        printf("%d\n",max);
    else if(sum3>sum1)
        printf("%d\n",max+min);
    else
        printf("%d\n",max+min+1);

}

#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]);
        score=score+a[i];
        if(a[i]>k)
        {
            k=a[i];
        }
    }
    int high;
    for(i=k;i<=100;i++)
    {
        high=k*n;
        if(score<=((high-1)/2))
        {
            break;
        }
        else
        {
            ++k;
        }
    }
    printf("%d",k+1);
    return 0;
}

#include<stdio.h>

int main() {
    int n, k, m = 0, a = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int v;
        scanf("%d", &v);
        a+= v;
        if (m < v) m = v;
    }
    k = m;
    while (k*n - 2*a < 0) k++;
    printf("%d", k);
    return 0;
}

#include <stdio.h>
int max(int a,int b){if(a>b) return a; else return b;}
int main (){
int i,n,sum = 0;
int ans,mx = -1;
scanf("%i",&n);
for (i=0;i<n;i++){
	int f;
	scanf("%i",&f);
	sum += f;
	mx = max (mx,f);
	}
ans = mx;
if( n*ans - sum <= sum ){
	ans += (2*sum - n*ans + n - 1) / n;
}
printf ("%i",ans);
return 0-0-0;
}

#include<stdio.h>
int main()
{
    int n,i,a[10000],sum=0,max=0,j,newsum=0,x,y;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
        if(a[i]>max)
        {
            max=a[i];
        }
    }
    for(i=0;i<n;i++)
    {
        newsum+=(max-a[i]);
    }
    if(newsum>sum)
    {
        printf("%d\n",max);
        return 0;
    }
    else
    {
        x=(((sum+1)-newsum)/n);
        y=x*n;//printf("%d %d %d %d %d\n",x,newsum,sum,max,y);
        if(y==(sum-newsum+1))
        {
            printf("%d\n",max+x);
            return 0;
        }
        else if(y!=n){
            printf("%d\n",max+x+1);return 0;}
    }

    return 0;
}

#include <stdio.h>
int main()
{
	int n, s=0;
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int max= a[0];
	for(int i=0;i<n;i++)
	{
		s=s+a[i];
		if(a[i]>max) max=a[i];
	}
//	printf("%d %d",s,max);
	int s1=0,b=max;
	for(int i=0;i<n;i++)
	{
		s1=s1+max-a[i];
	}
//	printf("s1= %d",s1);
	while(s1<s)
	{
		for(int i=0;i<n;i++)
		{
			s1=s1+b-a[i];
		}
		b++;
	}
	printf("%d",b);
	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]);
        score=score+a[i];
        if(a[i]>k)
        {
            k=a[i];
        }
    }
    int high=k*n;
    for(i=k;i<=100;i++)
    {
        if(score<(high/2))
        {
            break;
        }
        else
        {
            ++k;
        }
    }
    printf("%d",k);
    return 0;
}

#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    int i, k, j, largest, m, sum1=0, sum2;
    int a[100];
    for (i=0; i<n; i++)
    {
        scanf("%d", &a[i]);
        sum1 = sum1+a[i];
    }

    /*for (i=0; i<n; i++) //sum of the array
    {
        sum1 = sum1+a[i];
    } */
    //printf("%d\n", sum1);

    for (j=0; j<i; j++) //finding the largest num
    {
        if (a[j]>a[j+1])
        {
            largest = a[j];
        }

        else
        {
            continue;
        }
    }
    //printf("%d\n", largest);

    for (m=0; m<=100; m++)
    {
        k = largest+m;
        sum2 = (n*k) - sum1;
        if (sum2 > sum1)
        {
            break;
        }
    }

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

    return 0;
}


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

int main()
{char add[101];
int l,i,c=0;
scanf("%s",add);
l=strlen(add);
for(i=0;i<l;i++)
 { if(c==0)
  {
  if(add[i]=='a' && add[i+1]=='t' && i>0 && i<l-2)
   {printf("@");
    c++;
    i+=1;
    continue;
   }
   }
  if(add[i]=='d' && add[i+1]=='o' && add[i+2]=='t' && i>0 && i<l-3)
   {printf(".");
    i+=2;
    continue;
   }
  printf("%c",add[i]);
}
return 0;
}

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

int main(){

	char mail[110], aux[110];
	int i, j, sz;

	fgets( mail, 110, stdin );
	sz = strlen(mail);
	mail[sz-1] = mail[sz];
	i = 1, j = 1;
	aux[0] = mail[0];

	while( !(mail[i] == 'a' && mail[i+1] == 't') ) aux[j++] = mail[i++];
	aux[j++] = '@';
	i += 2;

	while( mail[i] ) aux[j++] = mail[i++];
	aux[j] = mail[i];
	sz = j;

	i = 1, j = 1;

	mail[0] = aux[0];

	while( (i+2) < (sz-1) ){
		if( aux[i] == 'd' && aux[i+1] == 'o' && aux[i+2] == 't' ){
			mail[j++] = '.';
			i += 3;
		} else mail[j++] = aux[i++];
	}

	while( aux[i] ) mail[j++] = aux[i++];
	mail[j] = aux[i];

	puts( mail );

	return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    char email[500],ara[100];
    int i,j,len,k=0;
    gets(email);
    len=strlen(email);
    for(i=0;i<len;i++)
    {
        if(email[i]>='a' && email[i]<='z') continue;
        else return 0;
    }
    if(len>=1 && len<=100)
    {
        ara[0]=email[0];
        for(i=1,j=1;i<len;)
        {
            if(email[i]=='d' && email[i+1]=='o' && email[i+2]=='t' && i+3!=len)
            {
                ara[j]='.';
                i=i+3;
                j++;
            }
            else if(email[i]=='a' && email[i+1]=='t' && k==0 && (i+2)!=len)
            {
                k=1;
                ara[j]='@';
                i=i+2;
                j++;
            }
            else
            {
                ara[j]=email[i];
                j++;
                i++;
            }
        }
        ara[j]='\0';
        printf("%s",ara);
    }
    return 0;
}

#include"stdio.h"
#include"string.h"
int main()
{
int i,l,c=1;
/*freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/
char a[101];
scanf("%s",a);
l=strlen(a);
printf("%c",a[0]);
for(i=1;i<l;)
{
if(a[i]=='a' && a[i+1]=='t' &&c)
{
	if(i!=l-2)
{printf("@");c=0;}
else
printf("at");
i+=2;
}
else if(a[i]=='d' &&a[i+1]=='o' &&a[i+2]=='t')
{if(i!=l-3)
	printf(".");
	else
	printf("dot");
	i+=3;
}
	else
	printf("%c",a[i++]);
}
printf("\n");
return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int foundat = 0, i, foundchar = 0;
    char s[101];
    scanf("%s", &s);
    for(i = 0; i < strlen(s); i++)
    {
          if(s[i] == 'a' && ( i != strlen(s) - 1 && s[i + 1] == 't') && foundat == 0 && i != 0)
          {
                  printf("@");
                  foundat = 1;
                  i++;
          }
          else if(s[i] == 'd' && i < strlen(s) - 1 && s[i + 1] == 'o' &&  i < strlen(s) - 3 && s[i + 2] == 't' && foundchar == 1)
          {
                  printf(".");
                  i += 2;
          }
          else
          {
                  foundchar = 1;
                  printf("%c", s[i]);
          }
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    char mail[101], save[101];
    int ok=1;
    scanf("%s",&mail);
    for(int i=0; i<strlen(mail); i++)
    {
        if(i)
        {
            if(mail[i]=='d'&&mail[i+1]=='o'&&mail[i+2]=='t'&&mail[i+3]!=NULL)
            {
                strcpy(save, mail+i+3);
                mail[i]='.';
                strcpy(mail+i+1, save);
            }
            if(mail[i]=='a'&&mail[i+1]=='t'&&mail[i+2]!=NULL&&ok)
            {
                strcpy(save, mail+i+2);
                mail[i]='@';
                strcpy(mail+i+1, save);
                ok=0;
            }
        }
    }
    printf("%s", mail);

    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
char str[101];
int i=1,chk=0;
scanf("%s",&str);
printf("%c",str[0]);
while(i!=strlen(str))
 {
   if(str[i]=='a')
    {
     if(chk==0)
     {
      if((str[i+1]=='t')&&((i+1)!=strlen(str)-1))
      {
       printf("@");
       i++;
       chk=1;
      }
     }
    else
     printf("%c",str[i]);
    }
  else if(str[i]=='d')
     {
      if((str[i+1]=='o')&&(str[i+2]=='t')&&((i+2)!=strlen(str)-1))
        {
         printf(".");
         i+=2;
        }
     else
       printf("%c",str[i]);
     goto xy;
     }
  else
   {
    printf("%c",str[i]);
    goto xy ;
   }
if(chk==0)
 printf("%c",str[i]);
xy : i++;
 }
return 0;
}

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

#define MAX_ADDRESS 101

int main()
{
	char address[MAX_ADDRESS], correct_address[MAX_ADDRESS] = {'\0'}, at_found = 0;
	gets(address);

	int i=0,j=0;

	if (strstr(address,"at") == address)
	{
		strcpy(correct_address,"at");
		i=2;
		j=2;
	}
	else if (strstr(address,"dot") == address)
	{
		strcpy(correct_address,"dot");
		i=3;
		j=3;
	}

	for(;address[i];i++)
	{
		if (address[i] != 'd' && address[i] != 'a')
			correct_address[j++] = address[i];
		else if (strstr(address+i,"dot") == address+i)
				{
					correct_address[j++] = '.';
					i+=2;
				}
			else if (!at_found && strstr(address+i,"at") == address +i)
				{
					correct_address[j++] = '@';
					i++;
					at_found = 1;
				}
			else
				correct_address[j++] = address[i];
	}

	j--;
	if (correct_address[j] == '.')
	{
		correct_address[j] = 'd';
		correct_address[j+1] = 'o';
		correct_address[j+2] = 't';
		correct_address[j+3]= '\0';
	}

	puts(correct_address);

	return 0;
}

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

int i,lenght,ok_at;
char s[101];

int main()
{
   scanf("%s",&s);
    lenght=strlen(s);

    for(i=1;i<lenght-2;i++)
    {

     if(s[i]=='d' && i<lenght-3)
            if(s[i+1]=='o' && s[i+2]=='t')
            {

                s[i]='.';
                 strcpy(s+i+1,s+i+3);
                 lenght-=2;

            }
        if(s[i]=='a' && ok_at==0)
            if(s[i+1]=='t')
                {
                    s[i]='@';
                    strcpy(s+i+1,s+i+2);
                    ok_at=1;
                    lenght-=1;

                }

    }
printf("%s",s);

    return 0;
}

#include <stdio.h>

int main(void)
{
  char c;
  char znak[400];
  int krok = 0;
  int i = 0;
  int zavynac = 0;

  while ((c = getchar()) != EOF){
    znak[i] = c;
    i++;
  }
  int maxi = i;

  for (i = 0; i < maxi; i++){
    if (i > 0){
      if ((znak[i] == 'd') && (znak[i + 1] == 'o') && (znak[i + 2] == 't') && ((i + 4) != maxi)){
        putchar('.');
        i++;
        i++;
      } else if ((znak[i] == 'a') && (znak[i + 1] == 't') && (zavynac == 0)){
        putchar('@');
        zavynac++;
        i++;
      } else {
        putchar(znak[i]);
      }
    } else {
      putchar(znak[i]);
    }
  }

  return 0;
}

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

int main(){
   char input[101];
   char output[100];
   int i, j;
   int at_count = 0;
   scanf("%s",input);

   j = 1;
   output[0] = input[0];
   for(i = 1; i<strlen(input)-1; ){
      if(input[i]=='a' && at_count==0 && i+2<strlen(input) && 0==strncmp("at",input+i,2)){
	    strncpy(output+j,"@",1);
	    j++;
	    i+=2;
	    at_count++;
      } else if(input[i]=='d' && i+3<strlen(input) && 0==strncmp("dot",input+i,3)){
	    strncpy(output+j,".",1);
	    j++;
	    i+=3;
      } else {
	 output[j]=input[i];
	 j++;
	 i++;
      }
   }
   output[j]=input[strlen(input)-1];
   output[j+1]=0;
   printf("%s",output);
   return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
	char st[1000],c;
	long la,i,d;
	while(gets(st))
	{
		printf("%c",st[0]);
		la=strlen(st)-1;
		c=st[la];

		st[la]=0;d=1;

		for(i=1;i<la;i++)
		{
			if(st[i]=='a')
			{
				if(st[i+1]=='t' && d)
				{
					printf("@");
					d=0;
					i+=1;
				}
				else printf("%c",st[i]);
			}
			else
			{
				if(st[i]=='d')
				{
					if(st[i+1]=='o' && st[i+2]=='t')
					{
						printf(".");
						i+=2;
					}
					else
						printf("%c",st[i]);
				}
				else printf("%c",st[i]);
			}

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

#include<stdio.h>
#include<string.h>
#define ifdot(a)  (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')
#define ifat(a) 	(str[a]=='a' && str[a+1]=='t')
#define endl puts("");
char str[200];
int main ()
{
	scanf("%s",str);
	int i,len=strlen(str),b=0;
	printf("%c",str[0]);
	for(i=1; i<len; i++)
	{
		if(ifdot(i) && i != len-3)
		{
			printf(".");
			i+=2;
			continue;
		}
		if (!b && ifat(i) && i != len-2)
		{
			printf("@");
			i++;
			b=1;
			continue;
		}
		printf("%c",str[i]);
	}
	endl;
	return 0;
}

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

#define PI 3.141592653589793
#define max(a,b) ((a < b) ? (b) : (a))
#define min(a,b) ((a > b) ? (b) : (a))
#define FOR(i,a,b) for(i = a ; i <= b ; i++)
#define ROF(i,a,b) for(i = a ; i >= b ; i--)
#define RAD(x) (((x)*PI)/180)
#define y1 y_1
#define endl printf("\n")
#define MAX 105

int i, u, k;
char s[MAX];

int main () {
	scanf("%s",s);
	u = strlen(s);
	FOR(i, 0, u - 1){
		if(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i + 2 != u - 1 &&i != 0){
			s[i] = '.';
			s[i + 1] = '\0';
			s[i + 2] = '\0';
		}
		else if(s[i] == 'a' && s[i + 1] == 't' && i != 0 &&i + 1 != u - 1 && !k){
			s[i] = '@';
			s[i + 1] = '\0';
			k = 1;
		}
	}
	FOR(i, 0, u - 1)
		if(s[i])
			printf("%c",s[i]);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    char mail[101], save[101];
    scanf("%s",&mail);
    for(int i=0; i<strlen(mail); i++)
    {
        if(i)
        {
            if(mail[i]=='d'&&mail[i+1]=='o'&&mail[i+2]=='t'&&mail[i+3]!=NULL)
            {
                strcpy(save, mail+i+3);
                mail[i]='.';
                strcpy(mail+i+1, save);
            }
            if(mail[i]=='a'&&mail[i+1]=='t'&&mail[i+2]!=NULL)
            {
                strcpy(save, mail+i+2);
                mail[i]='@';
                strcpy(mail+i+1, save);
            }
        }
    }
    printf("%s", mail);

    return 0;
}

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

int i,lenght,ok_at;
char s[100];

int main()
{
   scanf("%s",&s);
    lenght=strlen(s);

    for(i=1;i<lenght-2;i++)
    {
     if(s[i]=='d' && i<lenght-3)
            if(s[i+1]=='o' && s[i+2]=='t')
            {

                s[i]='.';
                 strcpy(s+i+1,s+i+3);
                 lenght-=2;
            }
        if(s[i]=='a' && ok_at==0)
            if(s[i+1]=='t')
                {
                    s[i]='@';
                    strcpy(s+i+1,s+i+2);
                    ok_at=1;
                    lenght-=1;
                }

    }
printf("%s",s);

    return 0;
}

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

int i,lenght,ok_at;
char s[101];

int main()
{
   scanf("%s",&s);
    lenght=strlen(s);

    for(i=1;i<lenght-2;i++)
    {
        printf("%c ",s[i]);
     if(s[i]=='d')
            if(s[i+1]=='o' && s[i+2]=='t')
            {

                s[i]='.';
                 strcpy(s+i+1,s+i+3);
                 lenght-=2;

            }
        if(s[i]=='a' && ok_at==0)
            if(s[i+1]=='t')
                {
                    s[i]='@';
                    strcpy(s+i+1,s+i+2);
                    ok_at=1;
                    lenght-=1;

                }

    }
printf("%s",s);

    return 0;
}

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

int i,lenght,ok_at;
char s[101];

int main()
{
   scanf("%s",&s);
    lenght=strlen(s);

    for(i=1;i<lenght-2;i++)
    {

     if(s[i]=='d')
            if(s[i+1]=='o' && s[i+2]=='t')
            {

                s[i]='.';
                 strcpy(s+i+1,s+i+3);
                 lenght-=2;

            }
        if(s[i]=='a' && ok_at==0)
            if(s[i+1]=='t')
                {
                    s[i]='@';
                    strcpy(s+i+1,s+i+2);
                    ok_at=1;
                    lenght-=1;

                }

    }
printf("%s",s);

    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
	char st[1000],c;
	long la,i;
	while(gets(st))
	{
		printf("%c",st[0]);
		la=strlen(st)-1;
		c=st[la];

		st[la]=0;

		for(i=1;i<la;i++)
		{
			if(st[i]=='a')
			{
				if(st[i+1]=='t')
				{
					printf("@");
					i+=1;
				}
				else printf("%c",st[i]);
			}
			else
			{
				if(st[i]=='d')
				{
					if(st[i+1]=='o' && st[i+2]=='t')
					{
						printf(".");
						i+=2;
					}
					else
						printf("%c",st[i]);
				}
				else printf("%c",st[i]);
			}

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

#include<stdio.h>
#include<string.h>
#define ifdot(a)  (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')
#define ifat(a) 	(str[a]=='a' && str[a+1]=='t')
#define endl puts("");
char str[200];
int main ()
{
	scanf("%s",str);
	int i,len=strlen(str);
	printf("%c",str[0]);
	for(i=1; i<len; i++)
	{
		if(ifdot(i))
		{
			printf(".");
			i+=2;
			continue;
		}
		if (ifat(i))
		{
			printf("@");
			i++;
			continue;
		}
		printf("%c",str[i]);
	}
	endl;
	return 0;
}

#include<stdio.h>
#include<string.h>
#define ifdot(a)  (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')
#define ifat(a) 	(str[a]=='a' && str[a+1]=='t')
#define endl puts("");
char str[200];
int main ()
{
	scanf("%s",str);
	int i,len=strlen(str),b=0;
	printf("%c",str[0]);
	for(i=1; i<len; i++)
	{
		if(ifdot(i) && i != len-3)
		{
			printf(".");
			i+=2;
			continue;
		}
		if (!b && ifat(i) && i != len-2)
		{
			printf("@");
			i++;
			continue;
		}
		printf("%c",str[i]);
	}
	endl;
	return 0;
}

#include<stdio.h>
#include<string.h>
#define ifdot(a)  (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')
#define ifat(a) 	(str[a]=='a' && str[a+1]=='t')
#define endl puts("");
char str[200];
int main ()
{
	scanf("%s",str);
	int i,len=strlen(str);
	printf("%c",str[0]);
	for(i=1; i<len-2; i++)
	{
		if(ifdot(i))
		{
			printf(".");
			i+=2;
			continue;
		}
		if (ifat(i))
		{
			printf("@");
			i++;
			continue;
		}
		printf("%c",str[i]);
	}
	for(i=len-2; i<len; i++)printf("%c",str[i]);
	endl;
	return 0;
}

#include<stdio.h>
#include<string.h>
#define ifdot(a)  (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')
#define ifat(a) 	(str[a]=='a' && str[a+1]=='t')
#define endl puts("");
char str[200];
int main ()
{
	scanf("%s",str);
	int i,len=strlen(str);
	printf("%c",str[0]);
	for(i=1; i<len; i++)
	{
		if(ifdot(i) && i != len-3)
		{
			printf(".");
			i+=2;
			continue;
		}
		if (ifat(i) && i != len-2)
		{
			printf("@");
			i++;
			continue;
		}
		printf("%c",str[i]);
	}
	endl;
	return 0;
}

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

#define PI 3.141592653589793
#define max(a,b) ((a < b) ? (b) : (a))
#define min(a,b) ((a > b) ? (b) : (a))
#define FOR(i,a,b) for(i = a ; i <= b ; i++)
#define ROF(i,a,b) for(i = a ; i >= b ; i--)
#define RAD(x) (((x)*PI)/180)
#define y1 y_1
#define endl printf("\n")
#define MAX 105

int i, u, k;
char s[MAX];

int main () {
	scanf("%s",s);
	u = strlen(s);
	FOR(i, 0, u - 1){
		if(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i + 2 != u - 1 &&i != 0){
			s[i] = '.';
			s[i + 1] = '\0';
			s[i + 2] = '\0';
		}
		else if(s[i] == 'a' && s[i + 1] == 't' && i + 1 != u - 1 && !k){
			s[i] = '@';
			s[i + 1] = '\0';
			k = 1;
		}
	}
	FOR(i, 0, u - 1)
		if(s[i])
			printf("%c",s[i]);
	return 0;
}

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

#define PI 3.141592653589793
#define max(a,b) ((a < b) ? (b) : (a))
#define min(a,b) ((a > b) ? (b) : (a))
#define FOR(i,a,b) for(i = a ; i <= b ; i++)
#define ROF(i,a,b) for(i = a ; i >= b ; i--)
#define RAD(x) (((x)*PI)/180)
#define y1 y_1
#define endl printf("\n")
#define MAX 105

int i, u;
char s[MAX];

int main () {
	scanf("%s",s);
	u = strlen(s);
	FOR(i, 0, u - 1){
		if(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i != 0){
			s[i] = '.';
			s[i + 1] = '\0';
			s[i + 2] = '\0';
		}
		else if(s[i] == 'a' && s[i + 1] == 't' && i + 1 != u - 1){
			s[i] = '@';
			s[i + 1] = '\0';
		}
	}
	FOR(i, 0, u - 1)
		if(s[i])
			printf("%c",s[i]);
	return 0;
}

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

#define PI 3.141592653589793
#define max(a,b) ((a < b) ? (b) : (a))
#define min(a,b) ((a > b) ? (b) : (a))
#define FOR(i,a,b) for(i = a ; i <= b ; i++)
#define ROF(i,a,b) for(i = a ; i >= b ; i--)
#define RAD(x) (((x)*PI)/180)
#define y1 y_1
#define endl printf("\n")
#define MAX 105

int i, u;
char s[MAX];

int main () {
	scanf("%s",s);
	u = strlen(s);
	FOR(i, 0, u - 1){
		if(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i != 0){
			s[i] = '.';
			s[i + 1] = '\0';
			s[i + 2] = '\0';
		}
		else if(s[i] == 'a' && s[i + 1] == 't' && i + 1 != u - 1){
			s[i] = '@';
			s[i + 1] = '\0';
		}
	}
	FOR(i, 0, u - 1)
		printf("%c",s[i]);
	return 0;
}

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

#define PI 3.141592653589793
#define max(a,b) ((a < b) ? (b) : (a))
#define min(a,b) ((a > b) ? (b) : (a))
#define FOR(i,a,b) for(i = a ; i <= b ; i++)
#define ROF(i,a,b) for(i = a ; i >= b ; i--)
#define RAD(x) (((x)*PI)/180)
#define y1 y_1
#define endl printf("\n")
#define MAX 105

int i, u, k;
char s[MAX];

int main () {
	scanf("%s",s);
	u = strlen(s);
	FOR(i, 0, u - 1){
		if(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i != 0){
			s[i] = '.';
			s[i + 1] = '\0';
			s[i + 2] = '\0';
		}
		else if(s[i] == 'a' && s[i + 1] == 't' && i + 1 != u - 1 && !k){
			s[i] = '@';
			s[i + 1] = '\0';
			k = 1;
		}
	}
	FOR(i, 0, u - 1)
		if(s[i])
			printf("%c",s[i]);
	return 0;
}

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

int main(){

	char mail[110], aux[110];
	int i, j, sz;

	fgets( mail, 100, stdin );
	sz = strlen(mail);
	mail[sz-1] = mail[sz];
	i = 1, j = 1;
	aux[0] = mail[0];

	while( !(mail[i] == 'a' && mail[i+1] == 't') ) aux[j++] = mail[i++];
	aux[j++] = '@';
	i += 2;

	while( mail[i] ) aux[j++] = mail[i++];
	aux[j] = mail[i];
	sz = j;

	i = 1, j = 1;

	mail[0] = aux[0];

	while( (i+2) < (sz-1) ){
		if( aux[i] == 'd' && aux[i+1] == 'o' && aux[i+2] == 't' ){
			mail[j++] = '.';
			i += 3;
		} else mail[j++] = aux[i++];
	}

	while( aux[i] ) mail[j++] = aux[i++];
	mail[j] = aux[i];

	puts( mail );

	return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    char email[500],ara[100];
    int i,j,len,k=0;
    gets(email);
    len=strlen(email);
    for(i=0;i<len;i++)
    {
        if(email[i]>='a' && email[i]<='z') continue;
        else return 0;
    }
    if(len>=1 && len<=100)
    {
        ara[0]=email[0];
        for(i=1,j=1;i<len;)
        {
            if(email[i]=='d' && email[i+1]=='o' && email[i+2]=='t' && i+3!=len)
            {
                ara[j]='.';
                i=i+3;
                j++;
            }
            else if(email[i]=='a' && email[i+1]=='t' && k==0 && (i+2)!=len)
            {
                k=1;
                ara[j]='@';
                i=i+2;
                j++;
            }
            else
            {
                ara[j]=email[i];
                j++;
                i++;
            }
        }
        printf("%s",ara);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int foundat = 0, i, foundchar = 0;
    char s[101];
    scanf("%s", &s);
    for(i = 0; i < strlen(s); i++)
    {
          if(s[i] == 'a' && ( i != strlen(s) - 1 && s[i + 1] == 't') && foundat == 0)
          {
                  printf("@");
                  foundat = 1;
                  i++;
          }
          else if(s[i] == 'd' && i < strlen(s) - 1 && s[i + 1] == 'o' &&  i < strlen(s) - 2 && s[i + 2] == 't' && foundchar == 1)
          {
                  printf(".");
                  i += 2;
          }
          else
          {
                  foundchar = 1;
                  printf("%c", s[i]);
          }
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int foundat = 0, i, foundchar = 0;
    char s[101];
    scanf("%s", &s);
    for(i = 0; i < strlen(s); i++)
    {
          if(s[i] == 'a' && ( i != strlen(s) - 1 && s[i + 1] == 't') && foundat == 0)
          {
                  printf("@");
                  foundat = 1;
                  i++;
          }
          else if(s[i] == 'd' && i < strlen(s) - 1 && s[i + 1] == 'o' &&  i < strlen(s) - 3 && s[i + 2] == 't' && foundchar == 1)
          {
                  printf(".");
                  i += 2;
          }
          else
          {
                  foundchar = 1;
                  printf("%c", s[i]);
          }
    }
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
char str1[101],str2[101];
int i,j;
scanf("%s",&str1);
scanf("%s",&str2);
if(strlen(str1)!=strlen(str2))
 {
  printf("NO\n");
  return 0;
 }
else
 {
  for(i=0,j=strlen(str2)-1;i<strlen(str1),j>=0;i++,j--)
   if(str1[i]!=str2[j])
     break;
 }
if(i!=strlen(str1))
 printf("NO\n");
else
 printf("YES\n");
return 0;
}

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

#define MAX_ADDRESS 101

int main()
{
	char address[MAX_ADDRESS], correct_address[MAX_ADDRESS] = {'\0'}, at_found = 0;
	gets(address);

	int i=0,j=0;

	if (strstr(address,"dot") == address)
	{
		strcpy(correct_address,"dot");
		i=3;
		j=3;
	}

	for(;address[i];i++)
	{
		if (address[i] != 'd' && address[i] != 'a')
			correct_address[j++] = address[i];
		else if (strstr(address+i,"dot") == address+i)
				{
					correct_address[j++] = '.';
					i+=2;
				}
			else if (!at_found && strstr(address+i,"at") == address +i)
				{
					correct_address[j++] = '@';
					i++;
					at_found = 1;
				}
			else
				correct_address[j++] = address[i];
	}

	j--;
	if (correct_address[j] == '.')
	{
		correct_address[j] = 'd';
		correct_address[j+1] = 'o';
		correct_address[j+2] = 't';
		correct_address[j+3]= '\0';
	}

	puts(correct_address);

	return 0;
}

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

int main()
{char add[101];
int l,i;
scanf("%s",add);
l=strlen(add);
for(i=0;i<l;i++)
 {if(add[i]=='a' && add[i+1]=='t' && i>0 && i<l-2)
   {printf("@");
    i++;
   }
  else if(add[i]=='d' && add[i+1]=='o' && add[i+2]=='t' && i>0 && i<l-4)
   {printf(".");
    i+=2;
   }
  else printf("%c",add[i]);
}
return 0;
}

#include <stdio.h>

int main(void)
{
  char c;
  char znak[400];
  int krok = 0;
  int i = 0;
  int zavynac = 0;

  while ((c = getchar()) != EOF){
    znak[i] = c;
    i++;
  }
  int maxi = i;

  for (i = 0; i < maxi; i++){
    if (i > 0){
      if ((znak[i] == 'd') && (znak[i + 1] == 'o') && (znak[i + 2] == 't') && ((i + 3) != maxi)){
        putchar('.');
        i++;
        i++;
      } else if ((znak[i] == 'a') && (znak[i + 1] == 't') && (zavynac == 0)){
        putchar('@');
        zavynac++;
        i++;
      } else {
        putchar(znak[i]);
      }
    } else {
      putchar(znak[i]);
    }
  }

  return 0;
}