n = int(input()) sum = 0 for _ in range(n): x = int(input()) base = x // 10 exponent = x % 10 sum += pow(base, exponent) print(sum)