Balanced numbers

Balanced Numbers

Description

A balanced number is a 3-digit number whose second digit is equal to the sum of the first and last digit.

Write a program which reads and sums balanced numbers. You should stop when an unbalanced number is given.

Input

You will receive an array as the only parameter of solve(args) function

  • Note: see sample tests

Output

Print to the standard output, i.e. with the console.log() method

  • Print the sum of the balanced numbers

Constraints

  • No more than 1000 numbers will be given

Sample tests

Sample test 1

Input

solve(['132', '123']);

Output

132

Sample test 2

Input

solve(['275', '693', '110', '742']);

Output

1078