palindromes

Time limit: 0.5s Memory limit: 64MB Input: Output:

Emilian is a very smart boy who loves palindromes. Radu knows this fact so he gifted his friend a set of nn integers, some being palindromes and other not. Emilian was very happy so he asked himself more questions and he will apreciate if you help him answering one of them. What is the sum of all palindrome integers from the set received from Radu?

Task

Given a set of nn integers calculate the sum of the palindrome integers.

Input

The first line contains the integer nn and the second line contains nn integers.

Output

The first line contains only one integer representing the sum of all palindrome integers.

Restrictions

  • 1n1 000 0001 \leq n \leq 1 \ 000 \ 000
  • All integers from the set are less than 1 000 000 0001 \ 000 \ 000 \ 000
# Points Restrictions
1 15 All integers from the set are palindromes
2 20 All integers from the set are <100< 100
3 30 All integers from the set are <1 000< 1\ 000
4 35 Normal restrictions

Example

stdin

5
1 13 22 121 45

stdout

144

Log in or sign up to be able to send submissions!