Sequence
시간 제한: 1000ms메모리 제한: 1024MB출처: BOI 2023BOJ 31979
문제
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.
예제
예제 1
입력
3 10 42 1
출력
10 52 53
코드를 제출하려면 로그인하세요.