Codeforces Round 122 (Div. 2)
E
Hamming Distance
Codeforces
未评级
原题
← D→
翻译中…

Hamming distance between strings $*a*$ and $*b*$ of equal length (denoted by $*h*(*a*, *b*)$) is equal to the number of distinct integers $*i*$ $(1 ≤ *i* ≤ |*a*|)$, such that $*a*_{*i*} ≠ *b*_{*i*}$, where $*a*_{*i*}$ is the $*i*$-th symbol of string $*a*$, $*b*_{*i*}$ is the $*i*$-th symbol of string $*b*$. For example, the Hamming distance between strings "aba" and "bba" equals $1$, they have different first symbols. For strings "bbba" and "aaab" the Hamming distance equals $4$.

翻译中…

John Doe had a paper on which four strings of equal length $*s*_{1}$, $*s*_{2}$, $*s*_{3}$ and $*s*_{4}$ were written. Each string $*s*_{*i*}$ consisted only of lowercase letters "a" and "b". John found the Hamming distances between all pairs of strings he had. Then he lost the paper with the strings but he didn't lose the Hamming distances between all pairs.

翻译中…

Help John restore the strings; find some four strings $*s*'_{1}$, $*s*'_{2}$, $*s*'_{3}, *s*'_{4}$ of equal length that consist only of lowercase letters "a" and "b", such that the pairwise Hamming distances between them are the same as between John's strings. More formally, set $*s*'_{*i*}$ must satisfy the condition image.

翻译中…

To make the strings easier to put down on a piece of paper, you should choose among all suitable sets of strings the one that has strings of minimum length.

翻译中…

Input

翻译中…

The first line contains space-separated integers $*h*(*s*_{1}, *s*_{2})$, $*h*(*s*_{1}, *s*_{3})$, $*h*(*s*_{1}, *s*_{4})$. The second line contains space-separated integers $*h*(*s*_{2}, *s*_{3})$ and $*h*(*s*_{2}, *s*_{4})$. The third line contains the single integer $*h*(*s*_{3}, *s*_{4})$.

翻译中…

All given integers $*h*(*s*_{*i*}, *s*_{*j*})$ are non-negative and do not exceed $10^{5}$. It is guaranteed that at least one number $*h*(*s*_{*i*}, *s*_{*j*})$ is positive.

翻译中…

Output

翻译中…

Print -1 if there's no suitable set of strings.

翻译中…

Otherwise print on the first line number $*len*$ — the length of each string. On the $*i*$-th of the next four lines print string $*s*'_{*i*}$. If there are multiple sets with the minimum length of the strings, print any of them.

翻译中…

样例

Input #1
4 4 4
4 4
4
Output #1
6
aaaabb
aabbaa
bbaaaa
bbbbbb
InputCopy OutputCopy
题目信息
题号
194E
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。