count_a, count_b = map(int, input().split())
name_a, name_b = input().split()
new_line = ""
if count_a > count_b:
for i in range(0,count_b):
new_line += (name_a[i] + name_b[i])
new_line += name_a[(count_b):]
elif count_a == count_b:
for i in range(0,count_a):
new_line += (name_a[i] + name_b[i])
elif count_a < count_b:
for i in range(0, count_a):
new_line += (name_a[i]+name_b[i])
new_line += name_b[(count_a):]
new_line = new_line.replace('A','3')
new_line = new_line.replace('B','2')
new_line = new_line.replace('C','1')
new_line = new_line.replace('D','2')
new_line = new_line.replace('E','4')
new_line = new_line.replace('F','3')
new_line = new_line.replace('G','1')
new_line = new_line.replace('H','3')
new_line = new_line.replace('I','1')
new_line = new_line.replace('J','1')
new_line = new_line.replace('K','3')
new_line = new_line.replace('L','1')
new_line = new_line.replace('M','3')
new_line = new_line.replace('N','2')
new_line = new_line.replace('O','1')
new_line = new_line.replace('P','2')
new_line = new_line.replace('Q','2')
new_line = new_line.replace('R','2')
new_line = new_line.replace('S','1')
new_line = new_line.replace('T','2')
new_line = new_line.replace('U','1')
new_line = new_line.replace('V','1')
new_line = new_line.replace('W','1')
new_line = new_line.replace('X','2')
new_line = new_line.replace('Y','2')
new_line = new_line.replace('Z','1')
rlt = new_line
while len(rlt)>2:
temp_rlt = []
for i in range(1,len(rlt)):
value = (int(rlt[i-1])+int(rlt[i]))%10
temp_rlt.append(value)
rlt = temp_rlt
haha = int(rlt[0])*10 + int(rlt[1])
print(str(haha)+"%")
N, M = map(int, input().split())
A, B = input().split()
alp = [3,2,1,2,4,3,1,3,1,1,#A~j
3,1,3,2,1,2,2,2,1,2, #k~t
1,1,1,2,2,1] #u~z
AB = ''
min_len = min(N,M)
for i in range(min_len):
AB += A[i] + B[i]
AB += A[min_len:] + B[min_len:]
lst = [alp[ord(i)-ord('A')] for i in [AB]
for i in range(N+M-2):
for i in range(N+M-1-i):
lst[j] += lst[j+1]
print("{}%".format(list[0]%10*10 + list[1]%10))