Welcome to ZOJ
Select Problem
ZOJ Problem Set - 3654
Letty's Math Class

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Letty Whiterock is a seasonal youkai who's only seen during winter. She seems fittingly cold towards most of the humans she meets, and many humans fear her abilities. However, because she shares the same ability with Cirno, she is one of Cirno's friend.

Letty Whiterock doesn't good at maths, so she asks Cirno to teach her - of course it's a bad idea - so that she can calculate quickly.

Cirno gives Letty some problems which have a expression with only '+' and '-' and two selection. Also, Cirno tells Letty how to calculate them:

  • If one of two selection is the number 9, then choose it. Cirno promises that there aren't two selections that are both the number 9.
  • Else, Letty should calculate the expression as usual, and then always choose the wrong selection. Cirno also promise that there aren't two wrong or right selection.

To make the problem more clear:

  • A number is a legal expression. For example, 123 is legal. We promise that each number's absolute value will not exceed 263-1.
  • [legal-expression]+[legal-expression] and [legal-expression]-[legal-expression] is legal, too. For example, 1+2+3 is legal, 1-2+3-4+5-6 is leagl, too.

Cirno thinks these problems can practise Letty's ability on maths. However, she doesn't sure about the answer of some questions. Please help Cirno to teach Letty!


The input contains less than 1000 test cases. NOTICE that's no empty line between each test case.

For each test case, first line is a expression, whose length will not exceed 1000. The expression only contains numbers, '+' and '-'. And the expression is always legal.

The second line has two numbers, which mean the two selection. The two numbers' absolute value will not exceed 263-1.

Process to END_OF_FILE.


For each test case, output "A" (without quotes) for choose the first selection and "B" (without quotes) for choose the second selection. The order of the selection is same as the order which appears in input.

Sample Input

9 21
-1 -2

Sample Output


Author: DAI, Longao
Submit    Status