Sequence
시간 제한1초메모리 제한1024 MB
각 값 v에 대해 v를 포함하는 좋은 수열의 최소 가중치를 구한다. 좋은 수열은 1로 시작하고 각 항이 이전 항에 1을 더한 값이거나 앞선 두 항의 곱이다.
문제
A sequence of positive integers is good if and for each we have either or for some and with . For instance, the sequences and are both good, but the sequence is not good. For given integers define the weight of an integer sequence satisfying for each as \[ w_{x_1} +\cdots +w_{x_m}\,.\] For instance, given the weights , the weight of the sequence is and the weight of the sequence is . For , define as the smallest possible weight of a good sequence containing the value .
Your task is to determine the values .
입력
The first line of input consists of the integer , the number of weights. The next lines contain the integer weights .
출력
Print lines containing , , in order.
제한
We always have and for each .