Broken Sequence
시간 제한4초메모리 제한64 MB
네 개의 부호 수열에서 일부 원소가 지워졌을 때, 모든 양의 이동에 대한 합성 자기상관이 0이 되도록 빠진 값을 복원한다.
문제
Let be a sequence . Then the nonperiodic autocorrelation function is: where is an integer. Here we assume that for and .
Consider four sequences of length , , , and correspondingly, all elements of which are from set . These four sequences form the -sequence (Turyn-Type sequence) if and only if
-sequences are very interesting because they allow building Hadamard matrices which find applications in such fields as signal processing and coding theory. For example, a -sequence for (which has been found in 2005) allowed to construct a Hadamard matrix of order for the first time.
Given a -sequence where several elements are missing, restore the initial -sequence.
입력
The four lines contain four strings of length , , and (, is even) which encode sequences , , and . The -th symbol encodes the -th element of the corresponding sequence. "-" denotes , "+" denotes , and "?" denotes a missing element. The total number of the missing elements does not exceed .
It is guaranteed that for the given data a single solution exists.
출력
Output four strings of length , , and --- the restored -sequence. See samples for better understanding of output format.