E. Vanya and Brackets(Codeforces Round #308 (Div. 2))
E.VanyaandBracketstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVanyaisdoinghismathshomework.Hehasanexpressionofform ,where x1, x2, ..., xn aredigitsfrom 1