Type: Default 1000ms 256MiB

250

No testdata at current.

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

小A 和 小B 在玩一个叫做《250》的游戏。

Description

游戏规则是这样的:

首先 小A 和 小B 会各自说一个 2 5 0 中的数字,其中 5 能赢 22 能赢 00 能赢 5

他们一共会比 NN 局,并且 小A 和 小B 都有一个出数周期。

小A 的出数周期的长度为 NANA,小B 的出数周期的长度为 NBNB

现在告诉你他们的出数周期,请你统计 NN 局当中谁赢得次数多。

Format

Input

第1行为3个整数 N,NA,NBN,\,NA,\,NB

第2行为 NANA 个整数 aia_i,表示 小A 的出数周期。

第3行为 NBNB 个整数 bib_i,表示 小B 的出数周期。

Output

如果 小A 赢,输出 A

如果 小B 赢,输出 B

如果两人平局,输出 AB

Samples

10 3 4
0 2 5
0 5 0 2
A

Limitation

1NA,NBN10181 \le NA,\,NB \le N \le 10^{18}

HARD

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
7
Start at
2024-3-29 15:15
End at
2024-3-29 15:45
Duration
0.5 hour(s)
Host
Partic.
2