import java.util.*;
import java.io.*;
class Main
{
public static void main
(final String[] args
) {
final int[] input = { 1, 4, 5, 2, 6, 7, 9, 8, 7, 10 };
// size * (size + 1) / 2 = input.length
int size
= (-1 + (int) Math.
sqrt(1 + 8 * input.
length)) / 2; // derived by quadratic formula
final int[] result = new int[size];
final int[] sum = new int[input.length + 1];
for (int i = 1; i <= input.length; i++) {
sum[i] = sum[i - 1] + input[i - 1];
}
for (int i = 1, j = 0; i <= input.length; i += ++j) {
result[j] = sum[i + j] - sum[i - 1];
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5pby4qOwoKY2xhc3MgTWFpbgp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoZmluYWwgU3RyaW5nW10gYXJncykKCXsKCQlmaW5hbCBpbnRbXSBpbnB1dCA9IHsgMSwgNCwgNSwgMiwgNiwgNywgOSwgOCwgNywgMTAgfTsKCQkvLyBzaXplICogKHNpemUgKyAxKSAvIDIgPSBpbnB1dC5sZW5ndGgKCQlpbnQgc2l6ZSA9ICgtMSArIChpbnQpIE1hdGguc3FydCgxICsgOCAqIGlucHV0Lmxlbmd0aCkpIC8gMjsKCQkvLyBkZXJpdmVkIGJ5IHF1YWRyYXRpYyBmb3JtdWxhCgkJZmluYWwgaW50W10gcmVzdWx0ID0gbmV3IGludFtzaXplXTsKCQlmaW5hbCBpbnRbXSBzdW0gPSBuZXcgaW50W2lucHV0Lmxlbmd0aCArIDFdOwoJCWZvciAoaW50IGkgPSAxOyBpIDw9IGlucHV0Lmxlbmd0aDsgaSsrKSB7CgkJICAgIHN1bVtpXSA9IHN1bVtpIC0gMV0gKyBpbnB1dFtpIC0gMV07CgkJfQoJCWZvciAoaW50IGkgPSAxLCBqID0gMDsgaSA8PSBpbnB1dC5sZW5ndGg7IGkgKz0gKytqKSB7CgkJICAgIHJlc3VsdFtqXSA9IHN1bVtpICsgal0gLSBzdW1baSAtIDFdOwoJCX0KCQlTeXN0ZW0ub3V0LnByaW50bG4oQXJyYXlzLnRvU3RyaW5nKHJlc3VsdCkpOwoJfQp9