//都是自己写的代码,没有拷贝,不一定是最简单的,有问题可以交流
/*
#include <stdio.h>//oj2005
int main(void){//for(),每个月天数存入数组
int y,m,d;
while(scanf("%d/%d/%d",&y,&m,&d)!=EOF){
int sum=0;
int a=0;
int b[12]={31,28,31,30,31,30,31,31,30,31,30,31};
sum+=b[i];
}
sum+=d;
printf("%d\n",sum);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2006求奇数的乘积
int main(void){
int a;
int b[1000];
while(scanf("%d",&a)!=EOF){
int s=1;
for(int i=0;i<a;i++){
scanf("%d",&b[i]);
if(b[i]%2!=0){
s*=b[i];
}
}
printf("%d\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2007平方和与立方和
int main(void){
int m,n;
while(scanf("%d%d",&m,&n)!=EOF){
long x=0,y=0;
if(m>n) {
int t=m; m=n; n=t;
}
for(int i=m;i<=n;i++){
i%2?x+=i*i*i:y+=i*i;
}
printf("%ld %ld\n",y,x);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2008数值统计
int main(void){
int a;
double b;
while(scanf("%d",&a)!=EOF){
int x=0,y=0,z=0;
if(a!=0){
for(int i=0;i<a;i++){
scanf("%lf",&b);
if(b>0){
z++;
}else if(b==0){
y++;
}else x++;
}
printf("%d %d %d\n",x,y,z);
}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2009求数列的和
#include<math.h>
int main(void){
int i,m,n;
double a,s;
while(scanf("%d%d",&m,&n)!=EOF){
for(i=0,a=m,s=0;i<n;i++){
s+=a;
a=sqrt(a);
}
printf("%.2f\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2010水仙花数
#include<math.h>
int main(void){
int m,n,i,j,a,b,c;
while(scanf("%d%d",&m,&n)!=EOF){
for(i=m,j=0;i<=n;i++){
a=i/100;
b=i%100/10;
c=i%10;
if(i==pow(a,3)+pow(b,3)+pow(c,3)){
j?printf(" %d",i):printf("%d",i);
j=1;
}
}
if(j){
printf("\n");
}else printf("no\n");
}
return 0;
}
*/
/*
#include<stdio.h>//oj2011多项式求和
int main(void){
int a,x,j;
double s;
scanf("%d",&a);
while(a--&&scanf("%d",&x)){
for(j=1,s=0;j<=x;j++){
j&1?s=s+(1.0/j):s=s-(1.0/j); //s += ((i & 1) ? 1.0 : -1.0) / i;
}
printf("%.2f\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2012素数判断
#include<math.h>
int main(void){
int m,n,i,s,j,a;
while(scanf("%d%d",&m,&n)!=EOF){
if(m!=0||n!=0){
for(i=m,a=1;i<=n;i++){
s=i*i+i+41;
for(j=2;j<=sqrt(s)&&a;j++){
if(s%j==0) a=0;
}
}if(a){
printf("OK\n");
}else printf("Sorry\n");
}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2013蟠桃记
int f(int n){
return n>1?(f(n-1)+1)*2:1;
}
int main(void){
int a;
while(scanf("%d",&a)!=EOF){
printf("%d\n",f(a));
}
return 0;
}
*/
/*
#include<stdio.h>//oj2014青年歌手赛
int main(void){
int a,i,x,max,min;
double s;
while(scanf("%d",&a)!=EOF){
scanf("%d",&x);
max=min=x;
for(i=0,s=min;i<a-1;i++){
scanf("%d",&x);
s+=x;
if(x>max){
max=x;
}else if(x<min){
min=x;
}
}
s=s-max-min;
s/=(a-2);
printf("%.2f\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2015偶数求和
int main(void){
int m,n,i,j,s,k,h,l;
while(scanf("%d%d",&m,&n)!=EOF){
h=m%n;
for(i=0,l=0;i<m-h;i+=n){
for(j=1,s=0;j<=n;j++){
s=s+i+j;
}
s=s*2/n;
l?printf(" %d",s):printf("%d",s);
l=1;
}
if(h!=0){
for(k=m-h+1,s=0;k<=m;k++){
s+=k;
}
s=s*2/h;
printf(" %d",s);
}
printf("\n");
}
return 0;
}
*/
/*
#include<stdio.h>//oj2016数据的交换输出
int main(void){
int x,i,a,j;
int b[100];
while(scanf("%d",&x)!=EOF){
if(x){
for(i=0,j=0;i<x;i++){
scanf("%d",&b[i]);
if(b[i]<b[j]){
j=i;
}
}if(j){
a=b[j];
b[j]=b[0];
b[0]=a;}
for(i=0;i<x;i++){
i?printf(" %d",b[i]):printf("%d",b[i]);//printf("%d%c", f[i], (i < n - 1 ? ' ' : '\n'));
}
printf("\n");}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2017字符串统计
#include<ctype.h>
int main(void){
int n,i;
char c;
scanf("%d ",&n);//空格对应第一行的换行
while(n--){
i=0;
while((c=getchar())!='\n'){
if(isdigit(c)) i++;}
printf("%d\n",i);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2018母牛的故事
int f(int n){
return n>3?f(n-3)+f(n-1):n;
}
int main(void){
int m;
while(scanf("%d",&m),m){
printf("%d\n",f(m));
}
return 0;
}
*/
/*
#include<stdio.h>//oj2019数列有序
int main(void){
int m,n,i,j;
int b[101];
while(scanf("%d%d",&n,&m),m||n){
for(i=0,j=1;i<=n;i++){
scanf("%d",&b[i]);
if(b[i]>m&&j){
b[i+1]=b[i];
b[i]=m;
i++;
j=0;
}
}
for(i=0;i<=n;i++){
i<n?printf("%d ",b[i]):printf("%d\n",b[i]);//printf("%d%c", x[i], (i - n ? ' ' : '\n'));
}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2020绝对值排序
#include<math.h>
int main(void){
int m,i,j,l,t;
int b[100];
while(scanf("%d",&m),m){
for(i=0;i<m;i++){
scanf("%d",&b[i]);
}
for(i=0,l=1;i<m&&l;i++){
for(j=0,l=0;j<m-i-1;j++){
if(abs(b[j])<abs(b[j+1])){
t=b[j];
b[j]=b[j+1];
b[j+1]=t;
l=1;
}
}
}
for(i=0;i<m;i++){
printf("%d%c",b[i],(i<m-1?' ':'\n'));
}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2021发工资
int main(void){
int m,i,x,s;
while(scanf("%d",&m),m){
for(i=0,s=0;i<m;i++){
scanf("%d",&x);
s=s+x/100+x%100/50+x%50/10+x%10/5+x%5/2+x%5%2;
}
printf("%d\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2022海选女主角
#include<math.h>
int main(void){
int i,j,m,n,a,b;
long x,y;
while(scanf("%d%d",&m,&n)!=EOF){
a=b=1;
y=0;
for(i=1;i<=m;i++){
for(j=1;j<=n;j++){
scanf("%ld",&x);
if(abs(x)>abs(y)){
y=x;
a=i;
b=j;
}
}
}
printf("%d %d %ld\n",a,b,y);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2023求平均成绩
int main(void){
int a[50][5],i,j,m,n,s,l;
double b[50],c[5]={0,0,0,0,0};
while(scanf("%d%d",&n,&m)!=EOF){
for(i=0;i<n;i++){
for(j=0,b[i]=0;j<m;j++){
scanf("%d",&a[i][j]);
b[i]+=a[i][j];
c[j]+=a[i][j];
}
}
for(i=0;i<n;i++){
printf("%.2f%c",b[i]/m,(i<n-1?' ':'\n'));
}
for(j=0;j<m;j++){
c[j]/=n;
printf("%.2f%c",c[j],(j<m-1?' ':'\n'));
}
for(i=0,s=0;i<n;i++){
for(j=0,l=1;j<m;j++){
if(c[j]>a[i][j])
l=0;
}
if(l) s++;
}
printf("%d\n\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2024C语言合法标志符
#include<ctype.h>
int f(char c){
if((c>='a'&&c<='z')||(c>='A'&&c<='Z')||c=='_'){
return 1;}
else return 0;
}
int main(void){
int n,i,j;
char c;
scanf("%d ",&n);//空格对应第一行的换行
while(n--){
for(i=0,j=1;(c=getchar())!='\n';i++){
if(j) j=(i?f(c)||isdigit(c):f(c));
}
printf("%s\n",(j?"yes":"no"));
}
return 0;
}
*/
/*
#include<stdio.h>//oj2025查找最大元素
int main(void){
int i;
char c[100]={0},j;
while(scanf("%c",&c[0])!=EOF){
for(i=1,j=c[0];(c[i]=getchar())!='\n';i++){//换行符也存入了
if(c[i]>j) j=c[i];
}
for(i=0;c[i]!='\0';i++){//k<=i;
if(c[i]==j){
printf("%c%s",c[i],"(max)");
}else printf("%c",c[i]);
c[i]='\0';
}
}
return 0;
}
*/
/*
#include <stdio.h>//oj2005
int main(void){//for(),每个月天数存入数组
int y,m,d;
while(scanf("%d/%d/%d",&y,&m,&d)!=EOF){
int sum=0;
int a=0;
int b[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if(y%4==0&&y%100!=0||y%400==0) {a=1; b[1]=29;}for(int i=0;i<m-1;i++){
sum+=b[i];
}
sum+=d;
printf("%d\n",sum);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2006求奇数的乘积
int main(void){
int a;
int b[1000];
while(scanf("%d",&a)!=EOF){
int s=1;
for(int i=0;i<a;i++){
scanf("%d",&b[i]);
if(b[i]%2!=0){
s*=b[i];
}
}
printf("%d\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2007平方和与立方和
int main(void){
int m,n;
while(scanf("%d%d",&m,&n)!=EOF){
long x=0,y=0;
if(m>n) {
int t=m; m=n; n=t;
}
for(int i=m;i<=n;i++){
i%2?x+=i*i*i:y+=i*i;
}
printf("%ld %ld\n",y,x);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2008数值统计
int main(void){
int a;
double b;
while(scanf("%d",&a)!=EOF){
int x=0,y=0,z=0;
if(a!=0){
for(int i=0;i<a;i++){
scanf("%lf",&b);
if(b>0){
z++;
}else if(b==0){
y++;
}else x++;
}
printf("%d %d %d\n",x,y,z);
}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2009求数列的和
#include<math.h>
int main(void){
int i,m,n;
double a,s;
while(scanf("%d%d",&m,&n)!=EOF){
for(i=0,a=m,s=0;i<n;i++){
s+=a;
a=sqrt(a);
}
printf("%.2f\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2010水仙花数
#include<math.h>
int main(void){
int m,n,i,j,a,b,c;
while(scanf("%d%d",&m,&n)!=EOF){
for(i=m,j=0;i<=n;i++){
a=i/100;
b=i%100/10;
c=i%10;
if(i==pow(a,3)+pow(b,3)+pow(c,3)){
j?printf(" %d",i):printf("%d",i);
j=1;
}
}
if(j){
printf("\n");
}else printf("no\n");
}
return 0;
}
*/
/*
#include<stdio.h>//oj2011多项式求和
int main(void){
int a,x,j;
double s;
scanf("%d",&a);
while(a--&&scanf("%d",&x)){
for(j=1,s=0;j<=x;j++){
j&1?s=s+(1.0/j):s=s-(1.0/j); //s += ((i & 1) ? 1.0 : -1.0) / i;
}
printf("%.2f\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2012素数判断
#include<math.h>
int main(void){
int m,n,i,s,j,a;
while(scanf("%d%d",&m,&n)!=EOF){
if(m!=0||n!=0){
for(i=m,a=1;i<=n;i++){
s=i*i+i+41;
for(j=2;j<=sqrt(s)&&a;j++){
if(s%j==0) a=0;
}
}if(a){
printf("OK\n");
}else printf("Sorry\n");
}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2013蟠桃记
int f(int n){
return n>1?(f(n-1)+1)*2:1;
}
int main(void){
int a;
while(scanf("%d",&a)!=EOF){
printf("%d\n",f(a));
}
return 0;
}
*/
/*
#include<stdio.h>//oj2014青年歌手赛
int main(void){
int a,i,x,max,min;
double s;
while(scanf("%d",&a)!=EOF){
scanf("%d",&x);
max=min=x;
for(i=0,s=min;i<a-1;i++){
scanf("%d",&x);
s+=x;
if(x>max){
max=x;
}else if(x<min){
min=x;
}
}
s=s-max-min;
s/=(a-2);
printf("%.2f\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2015偶数求和
int main(void){
int m,n,i,j,s,k,h,l;
while(scanf("%d%d",&m,&n)!=EOF){
h=m%n;
for(i=0,l=0;i<m-h;i+=n){
for(j=1,s=0;j<=n;j++){
s=s+i+j;
}
s=s*2/n;
l?printf(" %d",s):printf("%d",s);
l=1;
}
if(h!=0){
for(k=m-h+1,s=0;k<=m;k++){
s+=k;
}
s=s*2/h;
printf(" %d",s);
}
printf("\n");
}
return 0;
}
*/
/*
#include<stdio.h>//oj2016数据的交换输出
int main(void){
int x,i,a,j;
int b[100];
while(scanf("%d",&x)!=EOF){
if(x){
for(i=0,j=0;i<x;i++){
scanf("%d",&b[i]);
if(b[i]<b[j]){
j=i;
}
}if(j){
a=b[j];
b[j]=b[0];
b[0]=a;}
for(i=0;i<x;i++){
i?printf(" %d",b[i]):printf("%d",b[i]);//printf("%d%c", f[i], (i < n - 1 ? ' ' : '\n'));
}
printf("\n");}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2017字符串统计
#include<ctype.h>
int main(void){
int n,i;
char c;
scanf("%d ",&n);//空格对应第一行的换行
while(n--){
i=0;
while((c=getchar())!='\n'){
if(isdigit(c)) i++;}
printf("%d\n",i);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2018母牛的故事
int f(int n){
return n>3?f(n-3)+f(n-1):n;
}
int main(void){
int m;
while(scanf("%d",&m),m){
printf("%d\n",f(m));
}
return 0;
}
*/
/*
#include<stdio.h>//oj2019数列有序
int main(void){
int m,n,i,j;
int b[101];
while(scanf("%d%d",&n,&m),m||n){
for(i=0,j=1;i<=n;i++){
scanf("%d",&b[i]);
if(b[i]>m&&j){
b[i+1]=b[i];
b[i]=m;
i++;
j=0;
}
}
for(i=0;i<=n;i++){
i<n?printf("%d ",b[i]):printf("%d\n",b[i]);//printf("%d%c", x[i], (i - n ? ' ' : '\n'));
}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2020绝对值排序
#include<math.h>
int main(void){
int m,i,j,l,t;
int b[100];
while(scanf("%d",&m),m){
for(i=0;i<m;i++){
scanf("%d",&b[i]);
}
for(i=0,l=1;i<m&&l;i++){
for(j=0,l=0;j<m-i-1;j++){
if(abs(b[j])<abs(b[j+1])){
t=b[j];
b[j]=b[j+1];
b[j+1]=t;
l=1;
}
}
}
for(i=0;i<m;i++){
printf("%d%c",b[i],(i<m-1?' ':'\n'));
}
}
return 0;
}
*/
/*
#include<stdio.h>//oj2021发工资
int main(void){
int m,i,x,s;
while(scanf("%d",&m),m){
for(i=0,s=0;i<m;i++){
scanf("%d",&x);
s=s+x/100+x%100/50+x%50/10+x%10/5+x%5/2+x%5%2;
}
printf("%d\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2022海选女主角
#include<math.h>
int main(void){
int i,j,m,n,a,b;
long x,y;
while(scanf("%d%d",&m,&n)!=EOF){
a=b=1;
y=0;
for(i=1;i<=m;i++){
for(j=1;j<=n;j++){
scanf("%ld",&x);
if(abs(x)>abs(y)){
y=x;
a=i;
b=j;
}
}
}
printf("%d %d %ld\n",a,b,y);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2023求平均成绩
int main(void){
int a[50][5],i,j,m,n,s,l;
double b[50],c[5]={0,0,0,0,0};
while(scanf("%d%d",&n,&m)!=EOF){
for(i=0;i<n;i++){
for(j=0,b[i]=0;j<m;j++){
scanf("%d",&a[i][j]);
b[i]+=a[i][j];
c[j]+=a[i][j];
}
}
for(i=0;i<n;i++){
printf("%.2f%c",b[i]/m,(i<n-1?' ':'\n'));
}
for(j=0;j<m;j++){
c[j]/=n;
printf("%.2f%c",c[j],(j<m-1?' ':'\n'));
}
for(i=0,s=0;i<n;i++){
for(j=0,l=1;j<m;j++){
if(c[j]>a[i][j])
l=0;
}
if(l) s++;
}
printf("%d\n\n",s);
}
return 0;
}
*/
/*
#include<stdio.h>//oj2024C语言合法标志符
#include<ctype.h>
int f(char c){
if((c>='a'&&c<='z')||(c>='A'&&c<='Z')||c=='_'){
return 1;}
else return 0;
}
int main(void){
int n,i,j;
char c;
scanf("%d ",&n);//空格对应第一行的换行
while(n--){
for(i=0,j=1;(c=getchar())!='\n';i++){
if(j) j=(i?f(c)||isdigit(c):f(c));
}
printf("%s\n",(j?"yes":"no"));
}
return 0;
}
*/
/*
#include<stdio.h>//oj2025查找最大元素
int main(void){
int i;
char c[100]={0},j;
while(scanf("%c",&c[0])!=EOF){
for(i=1,j=c[0];(c[i]=getchar())!='\n';i++){//换行符也存入了
if(c[i]>j) j=c[i];
}
for(i=0;c[i]!='\0';i++){//k<=i;
if(c[i]==j){
printf("%c%s",c[i],"(max)");
}else printf("%c",c[i]);
c[i]='\0';
}
}
return 0;
}
*/