C. A Mist of Florescence


time limit per test

1 second



memory limit per test

256 megabytes



input

standard input



output

standard output


As the boat drifts down the river, a wood full of blossoms shows up on the riverfront.

"I've been here once," Mino exclaims with delight, "it's breathtakingly amazing."

"What is it like?"

"Look, Kanno, you've got your paintbrush, and I've got my words. Have a try, shall we?"


There are four kinds of flowers in the wood, Amaranths, Begonias, Centaureas and Dianthuses.

The wood can be represented by a rectangular grid of nn rows and mm

According to Mino, the numbers of connected components formed by each kind of flowers are aa, bb, cc and dd

You are to help Kanno depict such a grid of flowers, with nn and mm

Note that you can choose arbitrary nn and mm

Input


The first and only line of input contains four space-separated integers aa, bb, cc and dd (1≤a,b,c,d≤1001≤a,b,c,d≤100) — the required number of connected components of Amaranths, Begonias, Centaureas and Dianthuses, respectively.

Output


In the first line, output two space-separated integers nn and mm (1≤n,m≤501≤n,m≤50) — the number of rows and the number of columns in the grid respectively.

Then output nn lines each consisting of mm consecutive English letters, representing one row of the grid. Each letter should be among 'A', 'B', 'C' and 'D', representing Amaranths, Begonias, Centaureas and Dianthuses, respectively.

In case there are multiple solutions, print any. You can output each letter in either case (upper or lower).

Examples


Copy


5 3 2 1


Copy


4 7 DDDDDDD DABACAD DBABACD DDDDDDD


Copy


50 50 1 1


Copy


4 50 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ABABABABABABABABABABABABABABABABABABABABABABABABAB BABABABABABABABABABABABABABABABABABABABABABABABABA DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD


Copy


1 6 4 5


Copy


7 7 DDDDDDD DDDBDBD DDCDCDD DBDADBD DDCDCDD DBDBDDD DDDDDDD

Note


In the first example, each cell of Amaranths, Begonias and Centaureas forms a connected component, while all the Dianthuses form one.


C. A Mist of Florescence(构造)_构造

题目大概:

给你a  b  c  d四个字母的联通分量数,然后,让你在一个最大50*50的矩形内实现这种连通。只有相同颜色的挨着,才算连通。输出连通的图的样子。

思路:

我的思路麻烦了,是按照给的数字的大小,定好图的大小,然后再差不多按照例子的格式填充。但是这种题,根本不需判断,直接填充满50*50就好。

代码:

#include <bits/stdc++.h>

using namespace std;
const int maxn=110;
char ma[maxn][maxn];
int main()
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
int sum_ab=max(a/23,b/23)+1;
int sum_cd=max(c/23,d/23)+1;
int tu1=0,tu2=0;
if(a>b)a-=1,tu1=1;
else b-=1,tu1=2;
if(c>d)c-=1,tu2=3;
else d-=1,tu2=4;
int max_1=max(a,max(b,max(c,d)));
int sum=sum_ab+sum_cd;
int a1=0,b1=0,c1=0,d1=0;
char q;
int ans=0;
max_1*=2;
if(max_1>24)max_1=23*2;
for(int i=1;i<=sum*3;i+=3)
{
ans++;
if(ans<=sum_ab)
{
if(tu2==3)q='c';
else q='d';
for(int j=0;j<=max_1+1;j++)ma[i][j]=q;
for(int j=1;j<=max_1;j++)
{
if(j%2==1&&a1<=a-1)ma[i+1][j]='a',a1++;
if(j%2==0&&b1<=b-1)ma[i+1][j]='b',b1++;
}
for(int j=0;j<=max_1+1;j++)ma[i+2][j]=q;
for(int j=0;j<=max_1+1;j++)
{
if(ma[i+1][j]!='a'&&ma[i+1][j]!='b')ma[i+1][j]=q;
}
}
else
{
if(tu1==1)q='a';
else q='b';
for(int j=0;j<=max_1+1;j++)ma[i][j]=q;
for(int j=1;j<=max_1;j++)
{
if(j%2==1&&c1<=c-1)ma[i+1][j]='c',c1++;
if(j%2==0&&d1<=d-1)ma[i+1][j]='d',d1++;
}
for(int j=0;j<=max_1+1;j++)ma[i+2][j]=q;
for(int j=0;j<=max_1+1;j++)
{
if(ma[i+1][j]!='c'&&ma[i+1][j]!='d')ma[i+1][j]=q;
}
}
}
printf("%d %d\n",sum*3,max_1+2);
for(int i=1;i<=sum*3;i++)
{
for(int j=0;j<=max_1+1;j++)
{
printf("%c",ma[i][j]);
}
printf("\n");
}
return 0;
}