#CCC25J3. Product Codes

Product Codes

Problem Description

A store has hired the Code Cleaning Crew to update all of its product codes.

Each original product code is a sequence of letters and integers (both positive and negative). Example: cG23mH-9s.

To create the new product code:

  • Remove all lowercase letters.
  • Keep all uppercase letters in order.
  • Sum all integers and place the total at the end.

For example, cG23mH-9s becomes GH14.

Input Specification

  • The first line contains a positive integer N, representing the number of original product codes.
  • The next N lines each contain one product code.

Output Specification

Output the N new product codes, one per line.

Sample Input 1

1
AbC3c2Cd9

Sample Output 1

ACC14

Sample Input 2

3
Ahkiy-6ebvXCV1
393hhhUHkbs5gh6QpS-9-8
PL12N-2G1234Duytrty8-86tyaYySsDdEe

Sample Output 2

AXCV-5
UHQS387
PLNGDYSDE1166