Problem B. Batteries

Author:A. Karabanov   Time limit:1 sec
Input file:Standard input   Memory limit:64 Mb
Output file:Standard output  

Statement

A team of geologists is about to return from an expedition, but already prepares for the next one. The expedition leader sent a list of required items by radio.

Timofey is responsible for battery supplies. He has batteries of two types: AA and AAA. The message that he received looks like "quantity type" (without space). For example, a string "123AA" means that geologists need 123 batteries of the AA type, while a string "6AAA" means that they need 6 batteries of the AAA type.

Finally Timofey can get to work. Unfortunately, exactly one character in the message contains an error. Help Timofey to determine the maximum number of batteries of each type that geologists may require.

Input format

The only string in the input file is the string s. It's guaranteed that the string contains only characters from the following set: "0123456789A" (no quotes). It's guaranteed that the original radio message was valid (in particular, there was no leading zeros), and that exactly one character in it was changed.

Output format

The output must contain two nonnegative integers separated by a space — the largest number of if batteries of types AA and AAA respectively, which geologists may need according to their message.

Constraints

3 ≤ len(s) ≤ 5

Explanation of the samples

In the first sample the error may be in the first character. Then the original message could look like "923AA". The error could be in the second or in the third character, but Timofey still need to prepare at least 923 AA batteries. It's also possible that one of "A" characters was replaced with "3", and the original message was "12AAA". Thus Timofey needs at least 12 AAA batteries.

In the second sample the message could only be about AA batteries, while in the third one it could only be about AAA batteries.

Sample tests

No. Standard input Standard output
1
123AA
923 12
2
9AA
8 0
3
AAAA
0 9

0.128s 0.009s 13