64_2_PCG_05

Max Score = 100


# 0001, 2022-02-17 08:03:34, --- (0%)

key = input().split(',')
ans = input()
t = f = m = c = 0
for i in range(len(key)):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    else:
        if ans[i] == '-':
            m += 1
        else:
            f += 1
        c -= int(key[2])
print(t, f, m, c)



# 0002, 2022-02-17 08:05:12, P-x (33%)

key = input().split(',')
ans = input()
t = f = m = c = 0
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    else:
        if ans[i] == '-':
            m += 1
        else:
            f += 1
        c -= int(key[2])
print(t, f, m, c)

# 0003, 2022-02-17 08:06:37, PPx (67%)

key = input().split(',')
ans = input()
t = f = m = c = 0
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] == '-':
        m += 1
    else:
        f += 1
        c -= int(key[2])
print(t, f, m, c)



# 0004, 2022-02-17 08:08:38, PPx (67%)

key = input().split(',')
ans = input()
t = f = m = c = 0
if len(ans) < len(key):
    ans += 'q' * (len(key) - len(ans))
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] == '-':
        m += 1
    else:
        f += 1
        c -= int(key[2])
print(t, f, m, c)



# 0005, 2022-02-17 08:09:25, PPx (67%)

key = input().split(',')
ans = input()
t = f = m = c = 0
if len(ans) < len(key[0]):
    ans += 'q' * (len(key) - len(ans))
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] == '-':
        m += 1
    else:
        f += 1
        c -= int(key[2])
print(t, f, m, c)



# 0006, 2022-02-17 08:10:10, PP- (67%)

key = input().split(',')
ans = input()
t = f = m = c = 0
if len(ans) < len(key[0]):
    ans += 'q' * (len(key[0]) - len(ans))
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] == '-':
        m += 1
    else:
        f += 1
        c -= int(key[2])
print(t, f, m, c)



# 0007, 2022-02-17 08:11:57, PP- (67%)

key = input().split(',')
ans = input()
t = f = m = c = 0
if len(ans) < len(key[0]):
    ans += ' ' * (len(key[0]) - len(ans))
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] == '-':
        m += 1
    elif ans[i] == ' ':
        pass
    else:
        f += 1
        c -= int(key[2])
print(t, f, m, c)



# 0008, 2022-02-17 08:13:00, PP- (67%)

key = input().split(',')
ans = input()
t = f = m = c = 0
if len(ans) < len(key[0]):
    ans += ' ' * (len(key[0]) - len(ans))
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] == '-':
        m += 1
    elif ans[i] == ' ':
        m += 1
    else:
        f += 1
        c -= int(key[2])
print(t, f, m, c)


# 0009, 2022-02-17 08:13:55, PPP (100%)

key = input().split(',')
ans = input()
t = f = m = c = 0
if len(ans) < len(key[0]):
    ans += ' ' * (len(key[0]) - len(ans))
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] == '-':
        m += 1
    elif ans[i] == ' ':
        m += 1
    else:
        f += 1
        c -= int(key[2])
if c < 0:
    c = 0
print(t, f, m, c)



# 0010, 2022-02-17 08:14:28, PPP (100%)

key = input().split(',')
ans = input()
t = f = m = c = 0
if len(ans) < len(key[0]):
    ans += ' ' * (len(key[0]) - len(ans))
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] in '- ':
        m += 1
    else:
        f += 1
        c -= int(key[2])
if c < 0:
    c = 0
print(t, f, m, c)
# 0011, 2022-02-17 08:14:50, PPP (100%)

key = input().split(',')
ans = input()
t = f = m = c = 0
if len(ans) < len(key[0]):
    ans += '-' * (len(key[0]) - len(ans))
for i in range(len(key[0])):
    if ans[i] == key[0][i]:
        c += int(key[1])
        t += 1
    elif ans[i] in '-':
        m += 1
    else:
        f += 1
        c -= int(key[2])
if c < 0:
    c = 0
print(t, f, m, c)

# 0012, 2022-02-17 08:09:54, P-x (33%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif b[i] != a[i] :
        t += 1
        i += 1
    elif b[i] == "-" or b[i] == " " :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0013, 2022-02-17 08:11:59, PPx (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0014, 2022-02-17 08:13:27, PP- (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while len(b) != len(a) :
    b += " "

while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0015, 2022-02-17 08:14:06, PP- (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while len(b) != len(a) :
    b += " "

while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0016, 2022-02-17 08:14:21, PP- (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while len(b) != len(a) :
    b += "-"
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0017, 2022-02-17 08:15:03, P-x (33%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif b[i] != a[i] :
        t += 1
        i += 1
    elif b[i] == "-" or b[i] == " " :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0018, 2022-02-17 08:15:24, PPx (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0019, 2022-02-17 08:16:01, PPx (67%)

listt , pt , pf = input().split(',')
listf = input()
pt = int(pt)
pf = int(pf)
ct = 0
cf = 0
ch = 0
p = 0
for i in range(len(listt)):
    if listf[i] == listt[i] and listf[i] in ['T','F'] :
        ct += 1
        p += pt
    if listf[i] != listt[i] and listf[i] in ['T','F'] :
        cf += 1
        p -= pf
    if listf[i] == '-' :
        ch += 1
if p < 0 :
    p = 0
print(ct, cf , ch , p )
# 0020, 2022-02-17 08:16:44, PPP (100%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while len(b) != len(a) :
    b += "-"
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
if res <= 0 :
    res = 0

print(k,t,u,res)

# 0021, 2022-02-17 08:05:27, xxx (0%)

x = input().split()
sols = x[0]
corrScore = int(x[1])
wrongMinus = int(x[2])
ans = input()
corr =0
wrong =0
notDone = 0
score =0
for i,sol in enumerate(sols):
  if sol == ans[i]:
    corr +=1
    score += corrScore
  elif soll != ans[i] and ans[i] != "-":
    wrong = 0
    score-=wrongMinus
  else:
    notDone +=1
print(corr,wrong,notDone,score)
# 0022, 2022-02-17 08:05:39, xxx (0%)

x = input().split(",")
sols = x[0]
corrScore = int(x[1])
wrongMinus = int(x[2])
ans = input()
corr =0
wrong =0
notDone = 0
score =0
for i,sol in enumerate(sols):
  if sol == ans[i]:
    corr +=1
    score += corrScore
  elif soll != ans[i] and ans[i] != "-":
    wrong = 0
    score-=wrongMinus
  else:
    notDone +=1
print(corr,wrong,notDone,score)
# 0023, 2022-02-17 08:06:23, xxx (0%)

x = input().split(",")
sols = x[0]
corrScore = int(x[1])
wrongMinus = int(x[2])
ans = input()
corr =0
wrong =0
notDone = 0
score =0
for i,sol in enumerate(sols):
  if sol == ans[i]:
    corr +=1
    score += corrScore
  elif soll != ans[i] and ans[i] != "-":
    wrong = 0
    score-=wrongMinus
  else:
    notDone +=1
print(corr,wrong,notDone,score)
# 0024, 2022-02-17 08:06:36, xxx (0%)

x = input().split(",")
sols = x[0]
corrScore = float(x[1])
wrongMinus = float(x[2])
ans = input()
corr =0
wrong =0
notDone = 0
score =0
for i,sol in enumerate(sols):
  if sol == ans[i]:
    corr +=1
    score += corrScore
  elif soll != ans[i] and ans[i] != "-":
    wrong = 0
    score-=wrongMinus
  else:
    notDone +=1
print(corr,wrong,notDone,score)
# 0025, 2022-02-17 08:07:32, --x (0%)

x = input().split(",")
sols = x[0]
corrScore = int(x[1])
wrongMinus = int(x[2])
ans = input()
corr =0
wrong =0
notDone = 0
score =0
for i,sol in enumerate(sols):
  if sol == ans[i]:
    corr +=1
    score += corrScore
  elif ans[i] != "-":
    wrong = 0
    score-=wrongMinus
  else:
    notDone +=1
print(corr,wrong,notDone,score)
# 0026, 2022-02-17 08:07:49, --x (0%)

x = input().split(",")
sols = x[0]
corrScore = int(x[1])
wrongMinus = int(x[2])
ans = input()
corr =0
wrong =0
notDone = 0
score =0
for i,sol in enumerate(sols):
  if sol == ans[i]:
    corr +=1
    score += corrScore
  elif ans[i] != "-":
    wrong = 0
    score-=wrongMinus
  else:
    notDone +=1
print(corr,wrong,notDone,score if score >=0 else 0)
# 0027, 2022-02-17 08:09:15, --- (0%)

x = input().split(",")
sols = x[0]
corrScore = int(x[1])
wrongMinus = int(x[2])
ans = input()
corr = 0
wrong = 0
notDone = 0
score = 0
for i, sol in enumerate(sols):
    if i+1 < len(ans):
        if sol == ans[i]:
            corr += 1
            score += corrScore
        elif ans[i] != "-":
            wrong = 0
            score -= wrongMinus
        else:
            notDone += 1
    else:
        notDone += 1
print(corr, wrong, notDone, score if score >= 0 else 0)

# 0028, 2022-02-17 08:09:51, --- (0%)

x = input().split(",")
sols = x[0]
corrScore = int(x[1])
wrongMinus = int(x[2])
ans = input()
corr = 0
wrong = 0
notDone = 0
score = 0
for i, sol in enumerate(sols):
    if i+1 < len(ans):
        if sol == ans[i]:
            corr += 1
            score += corrScore
        elif ans[i] != "-":
            wrong +=1
            score -= wrongMinus
        else:
            notDone += 1
    else:
        notDone += 1
print(corr, wrong, notDone, score if score >= 0 else 0)

# 0029, 2022-02-17 08:10:21, PPP (100%)

x = input().split(",")
sols = x[0]
corrScore = int(x[1])
wrongMinus = int(x[2])
ans = input()
corr = 0
wrong = 0
notDone = 0
score = 0
for i, sol in enumerate(sols):
    if i+1 <= len(ans):
        if sol == ans[i]:
            corr += 1
            score += corrScore
        elif ans[i] != "-":
            wrong += 1
            score -= wrongMinus
        else:
            notDone += 1
    else:
        notDone += 1
print(corr, wrong, notDone, score if score >= 0 else 0)


# 0030, 2022-02-17 08:04:08, xxx (0%)

sol,cor,wrong = input().split() 
ans = input()
cor,wrong=int(cor),int(wrong)
score = 0
for i in range(len(sol)):
    if i > len(ans):
        break
    if sol[i] == ans[i]:
        score += cor
    elif ans[i] == '-':
        continue
    elif sol[i] != ans[i]:
        score -= cor
print(max(score, 0))
# 0031, 2022-02-17 08:04:26, --x (0%)

sol,cor,wrong = input().split(',') 
ans = input()
cor,wrong=int(cor),int(wrong)
score = 0
for i in range(len(sol)):
    if i > len(ans):
        break
    if sol[i] == ans[i]:
        score += cor
    elif ans[i] == '-':
        continue
    elif sol[i] != ans[i]:
        score -= cor
print(max(score, 0))
# 0032, 2022-02-17 08:05:16, --x (0%)

sol,cor,wrong = input().split(',') 
ans = input()
cor,wrong=int(cor),int(wrong)
score = 0
for i in range(len(sol)):
    if i > len(ans):
        break
    if sol[i] == ans[i]:
        score += cor
    elif ans[i] == '-':
        continue
    elif sol[i] != ans[i]:
        score -= wrong
print(max(score, 0))
# 0033, 2022-02-17 08:05:25, --x (0%)

sol,cor,wrong = input().split(',') 
ans = input()
cor,wrong=int(cor),int(wrong)
score = 0
for i in range(len(sol)):
    if i > len(ans):
        break
    if sol[i] == ans[i]:
        score += cor
    elif ans[i] == '-':
        continue
    elif sol[i] != ans[i]:
        score -= wrong
print(max(score, 0))
# 0034, 2022-02-17 08:08:13, PPx (67%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
for i in range(len(sol)):
    if i > len(ans):
        didntdo += len(sol) - len(ans)
        break
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0035, 2022-02-17 08:09:31, xxx (0%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += '-' * len(sol) - len(ans)
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0036, 2022-02-17 08:09:50, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))


# 0037, 2022-02-17 08:09:06, --x (0%)

x = input().split(',')
submit = input()
ans = x[0]
gain = int(x[1])
loss = int(x[2])
pts = 0
gain_count = 0
loss_count = 0
forgor = 0
for i in range(len(ans)):
    if submit[i] == ans[i]:
        pts += gain
        gain_count += 1
    elif submit[i] != ans[i] and submit[i] in 'TF':
        pts -= loss
        loss_count -= 1
    elif submit[i] != ans[i]:
        forgor += 1
print(gain_count, loss_count, forgor, pts)
# 0038, 2022-02-17 08:09:39, PPx (67%)

x = input().split(',')
submit = input()
ans = x[0]
gain = int(x[1])
loss = int(x[2])
pts = 0
gain_count = 0
loss_count = 0
forgor = 0
for i in range(len(ans)):
    if submit[i] == ans[i]:
        pts += gain
        gain_count += 1
    elif submit[i] != ans[i] and submit[i] in 'TF':
        pts -= loss
        loss_count += 1
    elif submit[i] != ans[i]:
        forgor += 1
print(gain_count, loss_count, forgor, pts)
# 0039, 2022-02-17 08:12:04, PP- (67%)

x = input().split(',')
submit = input()
ans = x[0]
gain = int(x[1])
loss = int(x[2])
pts = 0
gain_count = 0
loss_count = 0
forgor = 0
lendiff = len(submit) - len(ans)
ans += ' '*lendiff

for i in range(len(ans)):
    if submit[i:i+1] == ans[i:i+1]:
        pts += gain
        gain_count += 1
    elif submit[i:i+1] != ans[i:i+1] and submit[i:i+1] in 'TF':
        pts -= loss
        loss_count += 1
    elif submit[i:i+1] != ans[i:i+1]:
        forgor += 1
print(gain_count, loss_count, forgor, pts)
# 0040, 2022-02-17 08:13:16, PP- (67%)

x = input().split(',')
submit = input()
ans = x[0]
gain = int(x[1])
loss = int(x[2])
pts = 0
gain_count = 0
loss_count = 0
forgor = 0
lendiff = len(submit) - len(ans)
submit += ' '*lendiff

for i in range(len(ans)):
    if submit[i:i+1] == ans[i:i+1]:
        pts += gain
        gain_count += 1
    elif submit[i:i+1] != ans[i:i+1] and submit[i:i+1] in 'TF':
        pts -= loss
        loss_count += 1
    elif submit[i:i+1] != ans[i:i+1]:
        forgor += 1
print(gain_count, loss_count, forgor, pts)
# 0041, 2022-02-17 08:13:45, PP- (67%)

x = input().split(',')
submit = input()
ans = x[0]
gain = int(x[1])
loss = int(x[2])
pts = 0
gain_count = 0
loss_count = 0
forgor = 0

lendiff = len(ans) - len(submit)
submit += ' '*lendiff

for i in range(len(ans)):
    if submit[i:i+1] == ans[i:i+1]:
        pts += gain
        gain_count += 1
    elif submit[i:i+1] != ans[i:i+1] and submit[i:i+1] in 'TF':
        pts -= loss
        loss_count += 1
    elif submit[i:i+1] != ans[i:i+1]:
        forgor += 1
print(gain_count, loss_count, forgor, pts)
# 0042, 2022-02-17 08:14:21, PP- (67%)

x = input().split(',')
submit = input()
ans = x[0]
gain = int(x[1])
loss = int(x[2])
pts = 0
gain_count = 0
loss_count = 0
forgor = 0

lendiff = len(ans) - len(submit)
submit += ' '*lendiff

for i in range(len(ans)):
    if submit[i:i+1] == ans[i:i+1]:
        pts += gain
        gain_count += 1
    elif submit[i:i+1] != ans[i:i+1] and submit[i:i+1] in 'TF':
        pts -= loss
        loss_count += 1
    elif submit[i:i+1] != ans[i:i+1]:
        forgor += 1
print(gain_count, loss_count, forgor, pts)
# 0043, 2022-02-17 08:14:53, PPP (100%)

x = input().split(',')
submit = input()
ans = x[0]
gain = int(x[1])
loss = int(x[2])
pts = 0
gain_count = 0
loss_count = 0
forgor = 0

lendiff = len(ans) - len(submit)
submit += ' '*lendiff

for i in range(len(ans)):
    if submit[i:i+1] == ans[i:i+1]:
        pts += gain
        gain_count += 1
    elif submit[i:i+1] != ans[i:i+1] and submit[i:i+1] in 'TF':
        pts -= loss
        loss_count += 1
    elif submit[i:i+1] != ans[i:i+1]:
        forgor += 1
if pts <= 0:
    pts = 0
print(gain_count, loss_count, forgor, pts)

# 0044, 2022-02-17 08:04:24, xxx (0%)

ans = input().split(',')
ans_input = input()
point = int()
true = int()
false = int()
q = int()
for i in range(len()) :
    if ans_input[i] in 'TF' :
        if ans_input[i] == ans[0][i] :
            point += int(ans[1])
            true += 1
        else :
            point -= int(ans[2])
            false += 1
    else :
        point -= int(ans[2])
        q += 1

print(true, false, q, point)
# 0045, 2022-02-17 08:06:02, xxx (0%)

ans = input().split(',')
ans_input = input()
point = int()
true = int()
false = int()
q = int()
i = 0
for ch in input() :
    if ch in 'TF' :
        if ans_input[i] == ans[0][i] :
            point += int(ans[1])
            true += 1
        else :
            point -= int(ans[2])
            false += 1
    else :
        point -= int(ans[2])
        q += 1
    i += 1
q += len(ans[0][i:])

print(true, false, q, point)
# 0046, 2022-02-17 08:07:24, P-- (33%)

ans = input().split(',')
point = int()
true = int()
false = int()
q = int()
i = 0
for ch in input() :
    if ch in 'TF' :
        if ch == ans[0][i] :
            point += int(ans[1])
            true += 1
        else :
            point -= int(ans[2])
            false += 1
    else :
        point -= int(ans[2])
        q += 1
    i += 1
q += len(ans[0][i+1:])

print(true, false, q, point)
# 0047, 2022-02-17 08:07:47, PP- (67%)

ans = input().split(',')
point = int()
true = int()
false = int()
q = int()
i = 0
for ch in input() :
    if ch in 'TF' :
        if ch == ans[0][i] :
            point += int(ans[1])
            true += 1
        else :
            point -= int(ans[2])
            false += 1
    else :
        q += 1
    i += 1
q += len(ans[0][i+1:])

print(true, false, q, point)
# 0048, 2022-02-17 08:08:34, PP- (67%)

ans = input().split(',')
point = int()
true = int()
false = int()
q = int()
i = 0
for ch in input() :
    if ch in 'TF' :
        if ch == ans[0][i] :
            point += int(ans[1])
            true += 1
        else :
            point -= int(ans[2])
            false += 1
    else :
        q += 1
    i += 1
q += len(ans[0][i+1:])

if point < 0 :
  point = 0

print(true, false, q, point)
# 0049, 2022-02-17 08:09:31, PPP (100%)

ans = input().split(',')
point = int()
true = int()
false = int()
q = int()
i = 0
for ch in input() :
    if ch in 'TF' :
        if ch == ans[0][i] :
            point += int(ans[1])
            true += 1
        else :
            point -= int(ans[2])
            false += 1
    else :
        q += 1
    i += 1
q += len(ans[0][i:])

if point < 0 :
  point = 0

print(true, false, q, point)
# 0050, 2022-02-17 08:15:27, PPP (100%)

ans = input().split(',')
point = int()
true = int()
false = int()
q = int()
i = 0
for ch in input() :
    if ch in 'TF' :
        if ch == ans[0][i] :
            point += int(ans[1])
            true += 1
        else :
            point -= int(ans[2])
            false += 1
    else :
        q += 1
    i += 1
q += len(ans[0][i:])

if point < 0 :
  point = 0

print(true, false, q, point)

# 0051, 2022-02-17 08:05:44, xxx (0%)

a = input().split(',')
b = input()
t = 0; f = 0; d = 0; s = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        s += a[1]
        t += 1
    else:
        s -= a[2]
        f += 1
print(t, f, d, s)
# 0052, 2022-02-17 08:06:32, P-- (33%)

a = input().split(',')
b = input()
t = 0; f = 0; d = 0; s = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        s += int(a[1])
        t += 1
    else:
        s -= int(a[2])
        f += 1
print(t, f, d, s)
# 0053, 2022-02-17 08:07:32, P-- (33%)

a = input().split(',')
b = input()
t = 0; f = 0; d = len(a[0])-len(b); s = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        s += int(a[1])
        t += 1
    else:
        s -= int(a[2])
        f += 1
print(t, f, d, s)
# 0054, 2022-02-17 08:08:58, PP- (67%)

a = input().split(',')
b = input()
t = 0; f = 0; d = 0; s = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        s += int(a[1])
        t += 1
    elif b[i] == '-':
        d += 1
    else:
        s -= int(a[2])
        f += 1
    
print(t, f, d, s)
# 0055, 2022-02-17 08:10:07, PP- (67%)

a = input().split(',')
b = input()
t = 0; f = 0; d = len(a[0])-len(b); s = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        s += int(a[1])
        t += 1
    elif b[i] == '-':
        d += 1
    else:
        s -= int(a[2])
        f += 1
    
print(t, f, d, s)
# 0056, 2022-02-17 08:12:16, --- (0%)

a = input().split(',')
b = input()
t = 0; f = 0; d = len(a[0])-len(b); s = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        s += int(a[1])
        t += 1
    elif b[i] == '-':
        d += 1
    else:
        if s != 0:
            s -= int(a[2])
            f += 1
        f += 1
    
print(t, f, d, s)
# 0057, 2022-02-17 08:12:56, PPP (100%)

a = input().split(',')
b = input()
t = 0; f = 0; d = len(a[0])-len(b); s = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        s += int(a[1])
        t += 1
    elif b[i] == '-':
        d += 1
    else:
        if s != 0:
            s -= int(a[2])
            f += 1
        else:
            f += 1
    
print(t, f, d, s)

# 0058, 2022-02-17 08:04:43, xxx (0%)

a=input.split(',')
a2=input()
s=0
w=0
c=0
w2=0
for i in range(len(a)):
    if a=='T':
        s+=a[1]
        w+=1
    if a=='F':
        s-=a[2]
        w2+=1
    else:
        c+=1
print(w,w2,c,s)
# 0059, 2022-02-17 08:06:00, xxx (0%)

a=input.split(',')
a2=input()
s=0
w=0
c=0
w2=0
for i in range(len(a2)):
    if a2[i]==a[i]:
        s+=a[1]
        w+=1
    if a2[i]==a[i]:
        s-=a[2]
        w2+=1
    else:
        c+=1
c+=len(a)-len(a2)
print(w,w2,c,s)

# 0060, 2022-02-17 08:06:53, xxx (0%)

a=input().split(',')
a2=input()
s=0
w=0
c=0
w2=0
for i in range(len(a2)):
    if a2[i]==a[i]:
        s+=a[1]
        w+=1
    if a2[i]==a[i]:
        s-=a[2]
        w2+=1
    else:
        c+=1
c+=len(a)-len(a2)
print(w,w2,c,s)

# 0061, 2022-02-17 08:07:44, xxx (0%)

a=input().split(',')
a2=input()
s=0
w=0
c=0
w2=0
for i in range(len(a2)):
    if a2[i]==a[0][i]:
        s+=a[1]
        w+=1
    if a2[i]==a[0][i]:
        s-=a[2]
        w2+=1
    else:
        c+=1
c+=len(a)-len(a2)
print(w,w2,c,s)
# 0062, 2022-02-17 08:08:34, --- (0%)

a=input().split(',')
a2=input()
s=0
w=0
c=0
w2=0
for i in range(len(a2)):
    if a2[i]==a[0][i]:
        s+=int(a[1])
        w+=1
    if a2[i]==a[0][i]:
        s-=int(a[2])
        w2+=1
    else:
        c+=1
if s<0:
    s=0
c+=len(a)-len(a2)
print(w,w2,c,s)
# 0063, 2022-02-17 08:10:31, --- (0%)

a=input().split(',')
a2=input()
s=0
w=0
c=0
w2=0
for i in range(len(a2)):
    if a2[i]==a[0][i]:
        s+=int(a[1])
        w+=1
    if a2[i]==a[0][i]:
        s-=int(a[2])
        w2+=1
    else:
        c+=1
if s<0:
    s=0
c+=len(a)-len(a2)
print(w,w2,c,s)

# 0064, 2022-02-17 08:13:29, PPP (100%)

a = input().split(',')
ans = input()
a[1] = int(a[1])
a[2] = int(a[2])
cr = 0
wr = 0
n = 0
i = 0
for e in ans:
    if e == a[0][i]:
        cr += 1
    elif e == '-':
        n += 1
    elif e != a[0][i]:
        wr += 1
    i += 1

nc = cr
nw = wr
nn = n + len(a[0]) - len(ans)
p = cr*a[1] - wr*a[2]
if p < 0:
    p = 0
print(nc, nw, nn, p)

# 0065, 2022-02-17 08:08:29, xxx (0%)

c = input().split()
d = c[0]
a = input()
cc = 0
cw = 0
dd = 0
p = 0
for i in range(len(a)-1):
    if a[i] == d[i]:
        cc += 1
        p += int(c[1])
    elif a[i] != d[i] and a[i] != '-':
        cw += 1
        p -= int(c[2])
    elif a[i] != '-':
        dd +=1
print(cc, cw, dd, p)
# 0066, 2022-02-17 08:09:58, compilation error (0%)

c = input().split(,)
d = c[0]
a = input()
cc = 0
cw = 0
dd = 0
p = 0
for i in range(len(a)-1):
    if a[i] == d[i]:
        cc += 1
        p += int(c[1])
    elif a[i] != d[i] and a[i] != '-':
        cw += 1
        p -= int(c[2])
    elif a[i] != '-':
        dd +=1
print(cc, cw, dd, p)
# 0067, 2022-02-17 08:10:10, --- (0%)

c = input().split(',')
d = c[0]
a = input()
cc = 0
cw = 0
dd = 0
p = 0
for i in range(len(a)-1):
    if a[i] == d[i]:
        cc += 1
        p += int(c[1])
    elif a[i] != d[i] and a[i] != '-':
        cw += 1
        p -= int(c[2])
    elif a[i] != '-':
        dd +=1
print(cc, cw, dd, p)
# 0068, 2022-02-17 08:11:30, P-- (33%)

c = input().split(',')
d = c[0]
a = input()
cc = 0
cw = 0
dd = 0
p = 0
for i in range(len(a)):
    if a[i] == d[i]:
        cc += 1
        p += int(c[1])
    elif a[i] != d[i] and a[i] != '-':
        cw += 1
        p -= int(c[2])
    elif a[i] != '-':
        dd +=1
print(cc, cw, dd, p)
# 0069, 2022-02-17 08:12:02, P-- (33%)

c = input().split(',')
d = c[0]
a = input()
cc = 0
cw = 0
dd = 0
p = 0
for i in range(len(a)):
    if a[i] == d[i]:
        cc += 1
        p += int(c[1])
    elif a[i] != d[i] and a[i] != '-':
        cw += 1
        p -= int(c[2])
    elif a[i] != '-':
        dd +=1
if p < 0:
  p = 0
print(cc, cw, dd, p)
# 0070, 2022-02-17 08:13:42, P-- (33%)

c = input().split(',')
d = c[0]
a = input()
cc = 0
cw = 0
dd = 0
p = 0
for i in range(len(a)):
    if a[i] == d[i]:
        cc += 1
        p += int(c[1])
    elif a[i] != d[i] and a[i] != '-':
        cw += 1
        p -= int(c[2])
    elif a[i] != '-':
        cw += 1
        dd +=1
if p < 0:
  p = 0
print(cc, cw, dd, p)
# 0071, 2022-02-17 08:14:19, PPP (100%)

ans = input().split(',')
stu = input()
i = 0
x = 0
correct = 0
wrong = 0
u =0
if len(stu) - len(ans) != 0:
    u += len(ans[0])-len(stu)
for k in range(len(stu)) :
    if ans[0][k] == stu[k]:
        x += int(ans[1])
        correct += 1
    elif stu[k] == '-':
        u += 1
    elif ans[0][k] != stu[k]:
        x -= int(ans[2])
        wrong += 1
if x<0:
    x = 0
print(correct,wrong,u,x)

# 0072, 2022-02-17 08:07:17, PPx (67%)

answer = input().split(",")
a = input()
countc = 0
countd = 0
counte = 0
for i in range(len(answer[0])):
  if (answer[0])[i] == a[i] :
    countc += 1
  else :
    if a[i]!= "-" :
      countd += 1
    else :
      counte += 1
point = int(answer[1])*countc - int(answer[2])*countd
print(str(countc) + " " + str(countd) + " " + str(counte) + " " + str(point) )

# 0073, 2022-02-17 08:10:49, PPx (67%)

answer = input().split(",")
a = input()
countc = 0
countd = 0
counte = 0
e = 0
for i in range(len(answer[0])):
  if e<= len(a) :
    if (answer[0])[i] == a[e] :
      countc += 1
    else :
      if a[e]!= "-" :
        countd += 1
      else :
        counte += 1
    e += 1
  else :
    break
point = int(answer[1])*countc - int(answer[2])*countd
print(str(countc) + " " + str(countd) + " " + str(counte) + " " + str(point) )

# 0074, 2022-02-17 08:11:37, PP- (67%)

answer = input().split(",")
a = input()
countc = 0
countd = 0
counte = 0
e = 0
for i in range(len(answer[0])):
  if e<= len(a)-1 :
    if (answer[0])[i] == a[e] :
      countc += 1
    else :
      if a[e]!= "-" :
        countd += 1
      else :
        counte += 1
    e += 1
  else :
    break
point = int(answer[1])*countc - int(answer[2])*countd
print(str(countc) + " " + str(countd) + " " + str(counte) + " " + str(point) )

# 0075, 2022-02-17 08:13:16, PP- (67%)

answer = input().split(",")
a = input()
countc = 0
countd = 0
counte = 0
e = 0
for i in range(len(answer[0])):
  if e<= len(a)-1 :
    if (answer[0])[i] == a[e] :
      countc += 1
    else :
      if a[e]!= "-" :
        countd += 1
      else :
        counte += 1
    e += 1
  else :
    counte += 1
point = int(answer[1])*countc - int(answer[2])*countd
print(str(countc) + " " + str(countd) + " " + str(counte) + " " + str(point) )

# 0076, 2022-02-17 08:13:21, PP- (67%)

answer = input().split(",")
a = input()
countc = 0
countd = 0
counte = 0
e = 0
for i in range(len(answer[0])):
  if e<= len(a)-1 :
    if (answer[0])[i] == a[e] :
      countc += 1
    else :
      if a[e]!= "-" :
        countd += 1
      else :
        counte += 1
    e += 1
  else :
    counte += 1
point = int(answer[1])*countc - int(answer[2])*countd
print(str(countc) + " " + str(countd) + " " + str(counte) + " " + str(point) )
# 0077, 2022-02-17 08:14:23, PPP (100%)

answer = input().split(",")
a = input()
countc = 0
countd = 0
counte = 0
e = 0
for i in range(len(answer[0])):
  if e<= len(a)-1 :
    if (answer[0])[i] == a[e] :
      countc += 1
    else :
      if a[e]!= "-" :
        countd += 1
      else :
        counte += 1
    e += 1
  else :
    counte += 1
point = int(answer[1])*countc - int(answer[2])*countd
if point<0:
  point = 0
print(str(countc) + " " + str(countd) + " " + str(counte) + " " + str(point) )


# 0078, 2022-02-17 08:09:08, xxx (0%)

sol,x,y = input().split()
x = int(x)
y = int(y)
ans = input()
score = 0
correct = 0
num = 0
for i in ans:
    if ans[i] == sol[i]:
        score += x
        correct += 1
        num += 1
    else:
        score -= y
        num += 1
incorrect = num - correct
if len(sol) > len(ans):
    z = len(sol) - len(ans)
else:
    z = 0
print(correct,incorrect,z,score)

# 0079, 2022-02-17 08:10:02, xxx (0%)

sol,x,y = input().split(',')
x = int(x)
y = int(y)
ans = input()
score = 0
correct = 0
num = 0
for i in ans:
    if ans[i] == sol[i]:
        score += x
        correct += 1
        num += 1
    else:
        score -= y
        num += 1
incorrect = num - correct
if len(sol) > len(ans):
    z = len(sol) - len(ans)
else:
    z = 0
print(correct,incorrect,z,score)
# 0080, 2022-02-17 08:10:49, xxx (0%)

sol,x,y = input().split(',')
x = int(x)
y = int(y)
ans = input()
score = 0
correct = 0
num = 0
for i in len(ans):
    if ans[i] == sol[i]:
        score += x
        correct += 1
        num += 1
    else:
        score -= y
        num += 1
incorrect = num - correct
if len(sol) > len(ans):
    z = len(sol) - len(ans)
else:
    z = 0
print(correct,incorrect,z,score)
# 0081, 2022-02-17 08:11:35, P-- (33%)

sol,x,y = input().split(',')
x = int(x)
y = int(y)
ans = input()
score = 0
correct = 0
num = 0
for i in range(len(ans)):
    if ans[i] == sol[i]:
        score += x
        correct += 1
        num += 1
    else:
        score -= y
        num += 1
incorrect = num - correct
if len(sol) > len(ans):
    z = len(sol) - len(ans)
else:
    z = 0
print(correct,incorrect,z,score)
# 0082, 2022-02-17 08:13:56, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))
# 0083, 2022-02-17 08:14:04, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0084, 2022-02-17 08:10:06, --x (0%)

ans,p1,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(ans)):
    if d[i] == '-':
        n+=1
    elif ans[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(p1)*c)-(int(c)*w))
# 0085, 2022-02-17 08:10:28, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0086, 2022-02-17 08:13:34, PPx (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0087, 2022-02-17 08:13:59, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0088, 2022-02-17 08:15:06, PPx (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0089, 2022-02-17 08:15:30, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0090, 2022-02-17 08:10:18, --- (0%)

Key = input().split(",")
StdData = input()
Plus, Min, Zero = 0, 0, 0
for i in range(len(Key)):
    if StdData[i] == "-": Zero += 1
    elif StdData[i] == Key[i]: Plus += 1
    else: Min += 1
print(Plus, Min, Zero, Plus*int(Key[1]) - Min*int(Key[2]))
# 0091, 2022-02-17 08:11:04, --- (0%)

Key = input().split(",")
StdData = input()
Plus, Min, Zero = 0, 0, 0
for i in range(len(Key)):
    if StdData[i] == "-": Zero += 1
    elif StdData[i] == Key[i]: Plus += 1
    else: Min += 1
print(Plus, Min, Zero, Plus*int(Key[1]) - Min*int(Key[2]))
# 0092, 2022-02-17 08:13:04, --- (0%)

Key = input().split(",")
StdData = input()
Plus, Min, Zero = 0, 0, 0
for i in range(len(Key)):
  if StdData[i] == "-": Zero += 1
  elif StdData[i] == Key[i]: Plus += 1
  else: Min += 1
print(Plus, Min, Zero, Plus*int(Key[1]) - Min*int(Key[2]))
# 0093, 2022-02-17 08:13:51, --- (0%)

Key = input().split(",")
StdData = input()
Plus, Min, Zero = 0, 0, 0
for i in range(len(Key)):
    if StdData[i] == "-": Zero += 1
    elif StdData[i] == Key[i]: Plus += 1
    else: Min += 1
print(Plus, Min, Zero, Plus*int(Key[1]) - Min*int(Key[2]))
# 0094, 2022-02-17 08:14:46, --- (0%)

Key = input().split(",")
StdData = input()
Plus, Min, Zero = 0, 0, 0
for i in range(len(Key)):
    if StdData[i] == "-": 
      Zero += 1
    elif StdData[i] == Key[i]: 
      Plus += 1
    else: 
      Min += 1
print(Plus, Min, Zero, Plus*int(Key[1]) - Min*int(Key[2]))
# 0095, 2022-02-17 08:15:05, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0096, 2022-02-17 08:11:33, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0097, 2022-02-17 08:12:12, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0098, 2022-02-17 08:14:04, compilation error (0%)

p = input()
n = input
c = 0
in1 = 0
in2 = 0
in3 = 0
for i in range len(n) :
    if p[i] == "-" :
        in3 += 1
    elif p[i] == n[i] :
        in1 += 1
        c += p[1]
    elif p[i] != n[i] :
        in2 += 1
        c -= p[2]
print (in1,in2,in3,c)
        
# 0099, 2022-02-17 08:15:02, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0100, 2022-02-17 08:15:50, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0101, 2022-02-17 08:16:22, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0102, 2022-02-17 08:07:07, xxx (0%)

a = input().split(',')
b = input
t = 0
f = 0
n = 0
for i in range(len(b)):
    if b[i] == a[i]:
        p += 1
    if b[i] != a[i]:
        if b[i] in '-':
            n += 1
        else:
            f += 1
s = t * a[1]
st = s - f*a[2]
print(st,t,f,n)
# 0103, 2022-02-17 08:11:03, PP- (67%)

a = input().split(',')
b = input()
t = 0
f = 0
n = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        t += 1
    if b[i] != a[0][i]:
        if b[i] in '-':
            n += 1
        else:
            f += 1
s = t * int(a[1])
st = s - f*int(a[2])
print(t,f,n,st)
# 0104, 2022-02-17 08:12:25, PP- (67%)

a = input().split(',')
b = input()
t = 0
f = 0
n = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        t += 1
    if b[i] != a[0][i]:
        if b[i] in '-':
            n += 1
        else:
            f += 1
s = t * int(a[1])
st = s - f*int(a[2])
n += len(a[0])-len(b)
print(t,f,n,st)
# 0105, 2022-02-17 08:13:05, PP- (67%)

a = input().split(',')
b = input()
t = 0
f = 0
n = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        t += 1
    if b[i] != a[0][i]:
        if b[i] in '-':
            n += 1
        else:
            f += 1
s = t * int(a[1])
st = s - f*int(a[2])
n += len(a[0])-len(b)
print(t,f,n,st)
# 0106, 2022-02-17 08:14:20, PP- (67%)

a = input().split(',')
b = input()
t = 0
f = 0
n = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        t += 1
    if b[i] != a[0][i]:
        if b[i] in '-':
            n += 1
        else:
            f += 1
s = t * int(a[1])
st = s - f*int(a[2])
n += len(a[0])-len(b)
print(t,f,n,st)
        

# 0107, 2022-02-17 08:15:04, PPP (100%)

a = input().split(',')
b = input()
t = 0
f = 0
n = 0
for i in range(len(b)):
    if b[i] == a[0][i]:
        t += 1
    if b[i] != a[0][i]:
        if b[i] in '-':
            n += 1
        else:
            f += 1
s = t * int(a[1])
st = s - f*int(a[2])
n += len(a[0])-len(b)
if st <= 0 :
    st = 0
print(t,f,n,st)
        


# 0108, 2022-02-17 08:08:43, PP- (67%)

ans,plus,mi=input().split(',')
test=input()
t=0;f=0;n=0
for i in range(len(test)):
  if test[i]==ans[i]:
    t+=1
  elif test[i]!='-':
    f+=1
  else: n+=1
ts=t*int(plus)-f*int(mi)
print(t,f,n,ts)
# 0109, 2022-02-17 08:12:53, PP- (67%)

ans,plus,mi=input().split(',')
test=input()
test+=' '*10
t=0;f=0;n=0
for i in range(len(ans)):
  if test[i]==ans[i]:
    t+=1
  elif test[i]!='-' and test[i]!=' ':
    f+=1
  else: n+=1
ts=t*int(plus)-f*int(mi)
print(t,f,n,ts)
# 0110, 2022-02-17 08:13:15, PP- (67%)

ans,plus,mi=input().split(',')
test=input()
test+=' '*10
t=0;f=0;n=0
for i in range(len(ans)):
  if test[i]==ans[i]:
    t+=1
  elif test[i]!='-' and test[i]!=' ':
    f+=1
  else: n+=1
ts=t*int(plus)-f*int(mi)
print(t,f,n,ts)
# 0111, 2022-02-17 08:13:30, PP- (67%)

ans,plus,mi=input().split(',')
test=input()
test+=' '*100
t=0;f=0;n=0
for i in range(len(ans)):
  if test[i]==ans[i]:
    t+=1
  elif test[i]!='-' and test[i]!=' ':
    f+=1
  else: n+=1
ts=t*int(plus)-f*int(mi)
print(t,f,n,ts)
# 0112, 2022-02-17 08:15:35, PP- (67%)

ans,plus,mi=input().split(',')
test=input()
t=0;f=0;n=0
if len(test)<len(ans):
    n=len(ans)-len(test)
for i in range(len(test)):
  if test[i]==ans[i]:
    t+=1
  elif test[i]!='-':
    f+=1
  else: n+=1
ts=t*int(plus)-f*int(mi)
print(t,f,n,ts)
# 0113, 2022-02-17 08:17:09, PPP (100%)

ans,plus,mi=input().split(',')
test=input()
t=0;f=0;n=0
if len(test)<len(ans):
    n=len(ans)-len(test)
for i in range(len(test)):
  if test[i]==ans[i]:
    t+=1
  elif test[i]!='-':
    f+=1
  else: n+=1
ts=t*int(plus)-f*int(mi)
if ts<0:
  ts=0
print(t,f,n,ts)

# 0114, 2022-02-17 08:13:58, PP- (67%)

answer1 = input().split(',')
answer = answer1[0]
stu = input()
point = 0
right = 0
wrong =0
nothing = 0
for i in range (len(stu)):
    if answer[i] == stu[i]:
        point = point + int(answer1[1])
        right += 1
        
    elif stu[i] == '-':
        nothing += 1
        pass
    
    elif answer[i] != stu[i]:
        point = point - int(answer1[2])
        wrong += 1
print(right,wrong,nothing,point)
# 0115, 2022-02-17 08:15:24, xxx (0%)

answer1 = input().split(',')
answer = answer1[0]
stu = input()
point = 0
right = 0
wrong =0
nothing = 0
for i in range (len(stu)):
    if answer[i] == stu[i]:
        point = point + int(answer1[1])
        right += 1
        
    elif stu[i] == '-':
        nothing += 1
        if nothing <0:
          nothing = 0 
        pass
    
    elif answer[i] != stu[i]:
        point = point - int(answer1[2])
        wrong += 1
        if worong <0:
          wrong = 0
    
print(right,wrong,nothing,point)
# 0116, 2022-02-17 08:15:42, PP- (67%)

answer1 = input().split(',')
answer = answer1[0]
stu = input()
point = 0
right = 0
wrong =0
nothing = 0
for i in range (len(stu)):
    if answer[i] == stu[i]:
        point = point + int(answer1[1])
        right += 1
        
    elif stu[i] == '-':
        nothing += 1
        pass
    
    elif answer[i] != stu[i]:
        point = point - int(answer1[2])
        wrong += 1
  
    
print(right,wrong,nothing,point)
# 0117, 2022-02-17 08:16:32, PP- (67%)

answer1 = input().split(',')
answer = answer1[0]
stu = input()
point = 0
right = 0
wrong =0
nothing = 0
for i in range (len(stu)):
    if answer[i] == stu[i]:
        point = point + int(answer1[1])
        right += 1
        
    elif stu[i] == '-':
        nothing += 1
        pass
    
    elif answer[i] != stu[i]:
        point = point - int(answer1[2])
        wrong += 1
if point<0:
  point = 0
  
    
print(right,wrong,nothing,point)
# 0118, 2022-02-17 08:17:29, PPP (100%)

key = input().split(',')
p = int(key[1])
m = int(key[2])
key = key[0]
ans = input()
ans += ' '*(len(key) - len(ans))
cor = 0
wro = 0
no = 0
for i in range(len(key)) :
    if ans[i] not in ['T','F'] :
        no += 1
    elif ans[i] == key[i] :
        cor += 1
    elif ans[i] != key[i] :
        wro += 1
score = int((p*cor) - (m*wro))
if score < 0 :
    score = 0
print(cor,wro,no,score)

# 0119, 2022-02-17 08:06:09, xxx (0%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if a[i] == b[i] :
    x += int(b)
    y += 1
  elif a[i] == '-':
    p +=1
  else:
    x -= int(c)
    z += 1
print(y,z,p,x)
# 0120, 2022-02-17 08:09:28, P-- (33%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif a[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
print(y,z,p,x)
# 0121, 2022-02-17 08:11:17, PP- (67%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
print(y,z,p,x)
# 0122, 2022-02-17 08:12:26, PP- (67%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
print(y,z,p,x)
# 0123, 2022-02-17 08:13:53, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0124, 2022-02-17 08:08:29, P-- (33%)

trans = input().split(',')
ans = input()
score = 0
right = 0
wrong = 0

t = len(ans)
check = trans[0]
for i in range(len(ans)):
    if ans[i] == check[i]:
        score += int(trans[1])
        right += 1
    else :
        score -= int(trans[2])
        wrong += 1
print(right, wrong , len(trans[0])-len(ans),score)
    

# 0125, 2022-02-17 08:11:19, PP- (67%)

trans = input().split(',')
ans = input()
score = 0
right = 0
wrong = 0
notdone = 0
t = len(ans)
check = trans[0]
for i in range(len(ans)):
    if ans[i] == check[i]:
        score += int(trans[1])
        right += 1
    elif ans[i] != check[i] and ans[i] == '-' :
        notdone += 1
    elif ans[i] != check[i]:
        score -= int(trans[2])
        wrong += 1
print(right, wrong , notdone+len(trans[0])-len(ans),score)
    

# 0126, 2022-02-17 08:14:34, --- (0%)

trans = input().split(',')
ans = input()
score = 0
right = 0
wrong = 0
notdone = 0
t = len(ans)
check = trans[0]
for i in range(len(ans)-1):
    if ans[i] == check[i]:
        score += int(trans[1])
        right += 1
    elif ans[i] != check[i] and ans[i] == '-' :
        notdone += 1
    elif ans[i] != check[i] :
        score -= int(trans[2])
        wrong += 1
if score<=0:
    score = 0
print(right, wrong , notdone+len(trans[0])-len(ans),score)
    

# 0127, 2022-02-17 08:14:39, PPP (100%)

trans = input().split(',')
ans = input()
score = 0
right = 0
wrong = 0
notdone = 0
t = len(ans)
check = trans[0]
for i in range(len(ans)):
    if ans[i] == check[i]:
        score += int(trans[1])
        right += 1
    elif ans[i] != check[i] and ans[i] == '-' :
        notdone += 1
    elif ans[i] != check[i] :
        score -= int(trans[2])
        wrong += 1
if score<=0:
    score = 0
print(right, wrong , notdone+len(trans[0])-len(ans),score)
# 0128, 2022-02-17 08:14:58, PPP (100%)

trans = input().split(',')
ans = input()
score = 0
right = 0
wrong = 0
notdone = 0
t = len(ans)
check = trans[0]
for i in range(len(ans)):
    if ans[i] == check[i]:
        score += int(trans[1])
        right += 1
    elif ans[i] != check[i] and ans[i] == '-' :
        notdone += 1
    elif ans[i] != check[i] :
        score -= int(trans[2])
        wrong += 1
if score<=0:
    score = 0
print(right, wrong , notdone+len(trans[0])-len(ans),score)

# 0129, 2022-02-17 08:10:07, PPT (67%)

x = input().split(',')
x2 = list(x[0])
a = list(input())
cor = 0
wor = 0
none = 0
score = 0
while len(x2) != len(a):
    x2 += ['-']
for k in range(len(x2)):
    if x2[k] == a[k]:
        score += int(x[1])
        cor += 1
    elif a[k] == '-':
        none += 1
        score -= int(x[2])
    else :
        wor += 1
print(cor,wor,none,score)
# 0130, 2022-02-17 08:13:23, PP- (67%)

x = input().split(',')
x2 = list(x[0])
a = list(input())
cor = 0
wor = 0
none = 0
score = 0
while len(x2) != len(a):
    a += ['-']
for k in range(len(x2)):
    if x2[k] == a[k]:
        score += int(x[1])
        cor += 1
    elif a[k] == '-':
        none += 1
        score -= int(x[2])
    else :
        wor += 1
print(cor,wor,none,score)
# 0131, 2022-02-17 08:15:09, P-- (33%)

x = input().split(',')
x2 = list(x[0])
a = list(input())
cor = 0
wor = 0
none = 0
score = 0
while len(x2) != len(a):
    a += ['-']
for k in range(len(x2)):
    if x2[k] == a[k]:
        score += int(x[1])
        cor += 1
    elif a[k] == '-':
        none += 1
        score -= int(x[2])
    else :
        wor += 1
        score -= int(x[2])
print(cor,wor,none,score)
# 0132, 2022-02-17 08:15:51, PP- (67%)

x = input().split(',')
x2 = list(x[0])
a = list(input())
cor = 0
wor = 0
none = 0
score = 0
while len(x2) != len(a):
    a += ['-']
for k in range(len(x2)):
    if x2[k] == a[k]:
        score += int(x[1])
        cor += 1
    elif a[k] == '-':
        none += 1
    else :
        wor += 1
        score -= int(x[2])
print(cor,wor,none,score)
# 0133, 2022-02-17 08:17:15, PPP (100%)

x = input().split(',')
x2 = list(x[0])
a = list(input())
cor = 0
wor = 0
none = 0
score = 0
while len(x2) != len(a):
    a += ['-']
for k in range(len(x2)):
    if x2[k] == a[k]:
        score += int(x[1])
        cor += 1
    elif a[k] == '-':
        none += 1
    else :
        wor += 1
        if score >= int(x[2]):
          score -= int(x[2])
print(cor,wor,none,score)

# 0134, 2022-02-17 08:13:47, --x (0%)

import math
x = input().split(",")
y = input()
c = 0
d = 0
e = 0
f = 0
z = x[1:]
z1 = list(map(int,z))
for i in range(0,len(x[0])):
    if y[i] in x[0][i]:
        e+=1
        c += z1[0]
    if not y[i] in x[0][i]:
        d += z1[1]
        f+=1
print(e,f,(len(x)-(e+f)),(c-d))

# 0135, 2022-02-17 08:14:22, PPx (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0136, 2022-02-17 08:15:30, xxx (0%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    if (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0137, 2022-02-17 08:15:55, PPx (67%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0138, 2022-02-17 08:17:27, PPP (100%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while len(b) != len(a) :
    b += "-"
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
if res <= 0 :
    res = 0

print(k,t,u,res)

# 0139, 2022-02-17 08:12:42, --- (0%)

text,plus,down = input().split(',')
plus = int(plus)
down = int(down)
answer = input()
score = 0
cplus = 0
cdown = 0
cno = 0
for i in range(len(text)):
    if i < len(answer):
        if text[i] == answer[i]:
            score += plus
            cplus+=1
        if text[i] == answer[i]:
            score -= down
            cdown +=1
    else:
        cno +=1
        
print(cplus,cdown,cno,score)
        
# 0140, 2022-02-17 08:14:20, P-- (33%)

text,plus,down = input().split(',')
plus = int(plus)
down = int(down)
answer = input()
score = 0
cplus = 0
cdown = 0
cno = 0
for i in range(len(text)):
    if i < len(answer):
        if text[i] == answer[i]:
            score += plus
            cplus+=1
        if text[i] != answer[i]:
            score -= down
            cdown +=1
    else:
        cno +=1
        
print(cplus,cdown,cno,score)
        


# 0141, 2022-02-17 08:15:33, xxx (0%)

d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)
# 0142, 2022-02-17 08:15:56, compilation error (0%)

text,plus,down = input().split(',')
plus = int(plus)
down = int(down)
answer = input()
score = 0
cplus = 0
cdown = 0
cno = 0
for i in range(len(text)):
    if i < len(answer):
        if text[i] == 'T' or text[i] == 'F'
            if text[i] == answer[i]:
                score += plus
                cplus+=1
            if text[i] != answer[i]:
                score -= down
                cdown +=1
    else:
        cno +=1
        
print(cplus,cdown,cno,score)
        
# 0143, 2022-02-17 08:16:17, PPP (100%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = t*int(cr) - f*int(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)

# 0144, 2022-02-17 08:11:22, xxx (0%)

x,y,z=input().split(',')
a = input()
z,s,n=0,0,0
for i in range(len(x)):
    if a[i] == '-':
        n+=1
    elif x[i] == a[i]:
        z+=1
    else:
        s+=1
print(z,s,n,(int(y)*z)-(int(z)*S))
# 0145, 2022-02-17 08:12:06, --x (0%)

x,y,z=input().split(',')
a = input()
z,s,n=0,0,0
for i in range(len(x)):
    if a[i] == '-':
        n+=1
    elif x[i] == a[i]:
        z+=1
    else:
        s+=1
print(z,s,n,(int(y)*z)-(int(z)*s))
# 0146, 2022-02-17 08:12:19, --x (0%)

x,y,z=input().split(',')
a = input()
z,s,n=0,0,0
for i in range(len(x)):
    if a[i] == '-':
        n+=1
    elif x[i] == a[i]:
        z+=1
    else:
        s+=1
print(z,s,n,(int(y)*z)-(int(z)*s))
# 0147, 2022-02-17 08:12:44, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0148, 2022-02-17 08:14:30, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0149, 2022-02-17 08:13:49, xxx (0%)

ori, x, y = input().split(",")
x = int(b)
y = int(c)
tea = input()

ct, cf = 0, 0

for i in range(len(tea)):
  if tea[i] == '-':
    continue
  if tea[i] == ori[i]:
    ct += 1
  else:
    cf += 1

score = ct * b - cf * c
if score < 0:
  score = 0

print("{} {} {} {}".format(ct, cf, len(ori) - ct - cf, score))
# 0150, 2022-02-17 08:14:02, xxx (0%)

ori, b, c = input().split(",")
x = int(b)
y = int(c)
tea = input()

ct, cf = 0, 0

for i in range(len(tea)):
  if tea[i] == '-':
    continue
  if tea[i] == ori[i]:
    ct += 1
  else:
    cf += 1

score = ct * b - cf * c
if score < 0:
  score = 0

print("{} {} {} {}".format(ct, cf, len(ori) - ct - cf, score))
# 0151, 2022-02-17 08:14:33, xxx (0%)

ori, b, c = input().split(",")
x = int(b)
y = int(c)
tea = input()

ct, cf = 0, 0

for i in range(len(tea)):
  if tea[i] == '-':
    continue
  if tea[i] == ori[i]:
    ct += 1
  else:
    cf += 1

score = ct * b - cf * c
if score < 0:
  score = 0

print("{} {} {} {}".format(ct, cf, len(ori) - ct - cf, score))
# 0152, 2022-02-17 08:15:32, xxx (0%)

ori, b, c = input().split(",")
x = int(b)
y = int(c)
tea = input()

ct, cf = 0, 0

for i in range(len(tea)):
  if tea[i] == '-':
    continue
  if tea[i] == ori[i]:
    ct += 1
  else:
    cf += 1

score = ct * b - cf * c
if score < 0:
  score = 0

print("{} {} {} {}".format(ct, cf, len(ori) - ct - cf, score))
# 0153, 2022-02-17 08:15:58, PPP (100%)

ori, b, c = input().split(",")
b = int(b)
c = int(c)
tea = input()

ct, cf = 0, 0

for i in range(len(tea)):
  if tea[i] == '-':
    continue
  if tea[i] == ori[i]:
    ct += 1
  else:
    cf += 1

score = ct * b - cf * c
if score < 0:
  score = 0

print("{} {} {} {}".format(ct, cf, len(ori) - ct - cf, score))

# 0154, 2022-02-17 08:11:13, PPx (67%)

ans,c,w=input().split(",")
st_ans=str(input())
correct=0
wrong=0
dontdo=0
score=0
c=int(c)
w=int(w)

for i in range(len(ans)):
    if st_ans[i] == ans[i]:
        score+=c
        correct+=1
   
    elif st_ans[i] =="-" or st_ans == " ":
            dontdo+=1
    else:
        wrong+=1
        score-=w

print(correct,wrong,dontdo,score)   
# 0155, 2022-02-17 08:13:25, TTT (0%)

ans,c,w=input().split(",")
st_ans=str(input())
correct=0
wrong=0
dontdo=0
score=0
c=int(c)
w=int(w)
while len(st_ans) != 5 :
    st_ans+="-"
for i in range(len(ans)):
    if st_ans[i] == ans[i]:
        score+=c
        correct+=1
   
    elif st_ans[i] =="-" or st_ans == " ":
            dontdo+=1
    else:
        wrong+=1
        score-=w

print(correct,wrong,dontdo,score)             
                
# 0156, 2022-02-17 08:13:41, TTT (0%)

ans,c,w=input().split(",")
st_ans=str(input())
correct=0
wrong=0
dontdo=0
score=0
c=int(c)
w=int(w)
while len(st_ans) != 5 :
    st_ans+="-"
for i in range(len(ans)):
    if st_ans[i] == ans[i]:
        score+=c
        correct+=1
   
    elif st_ans[i] =="-" or st_ans == " ":
            dontdo+=1
    else:
        wrong+=1
        score-=w

print(correct,wrong,dontdo,score)
# 0157, 2022-02-17 08:14:01, PP- (67%)

ans,c,w=input().split(",")
st_ans=str(input())
correct=0
wrong=0
dontdo=0
score=0
c=int(c)
w=int(w)
if len(st_ans) != 5 :
    st_ans+="-"
for i in range(len(ans)):
    if st_ans[i] == ans[i]:
        score+=c
        correct+=1
   
    elif st_ans[i] =="-" or st_ans == " ":
            dontdo+=1
    else:
        wrong+=1
        score-=w

print(correct,wrong,dontdo,score)
# 0158, 2022-02-17 08:14:29, PPP (100%)

ans,c,w=input().split(",")
st_ans=str(input())
correct=0
wrong=0
dontdo=0
score=0
c=int(c)
w=int(w)
if len(st_ans) != 5 :
    st_ans+="-"
for i in range(len(ans)):
    if st_ans[i] == ans[i]:
        score+=c
        correct+=1
   
    elif st_ans[i] =="-" or st_ans == " ":
            dontdo+=1
    else:
        wrong+=1
        score-=w
if score < 0:
  score =0

print(correct,wrong,dontdo,score)

# 0159, 2022-02-17 08:14:36, P-x (33%)

ans, ts, fs = input().split(',')
key = input()
score = 0
t_choice = 0
f_choice = 0
none = 0
for i in range(len(ans)):
  if ans[i] == key[i]:
    score += int(ts)
    t_choice += 1
  elif ans[i] != key[i]:
    if ans[i] == '-' or ans[i] == ' ':
      score += 0
      none += 1
    else:
      score -= int(fs)
      f_choice +=1
print(t_choice,f_choice,none,score,end = ' ')

# 0160, 2022-02-17 08:16:08, xxx (0%)

ans, ts, fs = input().split(",")
sol = input()
ts, fs = int(ts), int(fs)
score = 0
cor, wrong = 0, 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif sol[i] != ans[i] and ans[i] != '-':
        wrong += 1
        score -= swrong
print(cor, wrong, len(ans)-cor-wrong, max(score, 0)) 
# 0161, 2022-02-17 08:16:14, xxx (0%)

ans, ts, fs = input().split(",")
ans = input()
ts, fs = int(ts), int(fs)
score = 0
cor, wrong = 0, 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif sol[i] != ans[i] and ans[i] != '-':
        wrong += 1
        score -= swrong
print(cor, wrong, len(ans)-cor-wrong, max(score, 0))
# 0162, 2022-02-17 08:16:26, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif sol[i] != ans[i] and ans[i] != '-':
        wrong += 1
        score -= swrong
print(cor, wrong, len(ans)-cor-wrong, max(score, 0)) 
# 0163, 2022-02-17 08:17:03, PPP (100%)

sol, ts, fs = input().split(",")
ans = input()
scor, swrong = int(ts), int(fs)
score = 0
cor, wrong = 0, 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif sol[i] != ans[i] and ans[i] != '-':
        wrong += 1
        score -= swrong
print(cor, wrong, len(ans)-cor-wrong, max(score, 0))

# 0164, 2022-02-17 08:06:41, xxx (0%)

s,t,f=input().split(',')
t=int(t)
f=int(f)
ans=input()
sumscore=0
true=0
false=0
notdo=len(s)-len(ans)
for i in range(len(ans)):
    if s[i]==ans[i]:
        sumscore+= t
        true+=1
    if s[i]!=ans[i]:
        sumsc+=1
print(true,false,notdo,sumscore)
    

# 0165, 2022-02-17 08:08:26, P-- (33%)

s,t,f=input().split(',')
t=int(t)
f=int(f)
ans=input()
sumscore=0
true=0
false=0
notdo=len(s)-len(ans)
for i in range(len(ans)):
    if s[i]==ans[i]:
        sumscore+= t
        true+=1
    if s[i]!=ans[i]:
        sumscore-=f
        false+=1
print(true,false,notdo,sumscore)
    

# 0166, 2022-02-17 08:11:18, P-- (33%)

s,t,f=input().split(',')
t=int(t)
f=int(f)
ans=input()
sumscore=0
true=0
false=0
notdo=len(s)-len(ans)
for i in range(len(ans)):
    if s[i]==ans[i]:
        sumscore+= t
        true+=1
    if s[i]!=ans[i]:
        sumscore-=f
        false+=1
if sumscore<0:
    sumscore=0
print(true,false,notdo,sumscore)
    

# 0167, 2022-02-17 08:13:04, P-- (33%)

s,t,f=input().split(',')
t=int(t)
f=int(f)
ans=input()
sumscore=0
true=0
false=0
notdo=len(s)-len(ans)
for i in range(len(ans)):
    if ans=='-':
        notdo+=1
    elif s[i]==ans[i]:
        sumscore+= t
        true+=1
    elif s[i]!=ans[i]:
        sumscore-=f
        false+=1
if sumscore<0:
    sumscore=0
print(true,false,notdo,sumscore)
    

# 0168, 2022-02-17 08:15:13, PPP (100%)

s,t,f=input().split(',')
t=int(t)
f=int(f)
ans=input()
sumscore=0
true=0
false=0
notdo=len(s)-len(ans)
for i in range(len(ans)):
    if ans[i]=='-':
        notdo+=1
    elif s[i]==ans[i]:
        sumscore+= t
        true+=1
    elif s[i]!=ans[i]:
        sumscore-=f
        false+=1
if sumscore<0:
    sumscore=0
print(true,false,notdo,sumscore)
    


# 0169, 2022-02-17 08:11:50, xxx (0%)

x,y,z=input().split(',')
d=input()
z,w,n=0,0,0
for i in range(len(x)):
    if d[i] == '-':
        n+=1
    elif x[i] == d[i]:
        c+=1
    else:
        w+=1
print(z,w,n,(int(y)*z)-(int(z)*w))
# 0170, 2022-02-17 08:12:09, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0171, 2022-02-17 08:14:43, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)
# 0172, 2022-02-17 08:16:10, compilation error (0%)

       x=input().split(,)
        y=input()
        z=x[1]
        c=0
        d=0
        e=0
        if len(z)==5:
            for i in range (len(z)):
            if y[i]==x[i]:
                c+=3
            if y[i]!=x[i]:
                c-=1
                d+=1
            if y[i]=="-":
        if len(z)==7:
            for i in range (len(z)):
            if y[i]==x[i]:
                c+=3
            if y[i]!=x[i]:
                c-=1
                d+=1
            if y[i]=="-":
                e+=1
        print(c,d,e)
# 0173, 2022-02-17 08:16:39, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0174, 2022-02-17 08:05:09, compilation error (0%)

print(1 4 1 0)
# 0175, 2022-02-17 08:10:16, PPx (67%)

sol,true,false = input().split(',')
ans = input()
ans1 = [' ']*len(sol)
ans1[::] = ans[::]
count_true = 0
count_false = 0
count_not = 0
score = 0
for i in range(len(sol)) :
    if ans1[i] == sol[i] :
        count_true += 1
    elif ans1[i] == '-' or ans1 == ' ' :
        count_not += 1
    else :
        count_false += 1
score = count_true*int(true) - count_false*int(false)
print(count_true,count_false,count_not,score)
# 0176, 2022-02-17 08:12:55, PPx (67%)

sol,true,false = input().split(',')
ans = input()
ans1 = [' ']*len(sol)
ans1[::] = ans[::]
count_true = 0
count_false = 0
count_not = 0
score = 0
for i in range(len(sol)) :
    if ans1[i] == sol[i] :
        count_true += 1
    elif ans1[i] == '-' or ans1 == ' ' :
        count_not += 1
    else :
        count_false += 1
score = count_true*int(true) - count_false*int(false)
if score <= 0 :
  score =0
print(count_true,count_false,count_not,score)
# 0177, 2022-02-17 08:15:51, PP- (67%)

sol,true,false = input().split(',')
ans = input()

if len(ans) != len(sol):
    ans += '-'*(len(sol)-len(ans))
count_true = 0
count_false = 0
count_not = 0
score = 0
for i in range(len(sol)) :
    if ans[i] == sol[i] :
        count_true += 1
    elif ans[i] == '-' :
        count_not += 1
    else :
        count_false += 1

score = count_true*int(true) - count_false*int(false)

print(count_true,count_false,count_not,score)
# 0178, 2022-02-17 08:16:29, PPP (100%)

sol,true,false = input().split(',')
ans = input()

if len(ans) != len(sol):
    ans += '-'*(len(sol)-len(ans))
count_true = 0
count_false = 0
count_not = 0
score = 0
for i in range(len(sol)) :
    if ans[i] == sol[i] :
        count_true += 1
    elif ans[i] == '-' :
        count_not += 1
    else :
        count_false += 1

score = count_true*int(true) - count_false*int(false)
if score <= 0 :
  score = 0
print(count_true,count_false,count_not,score)

# 0179, 2022-02-17 08:06:25, P-- (33%)

s = input().split(',')
ans = input()
point,c,w,d = 0,0,0,0
for i in range(len(ans)):
    if ans[i] == s[0][i]:
        point += int(s[1])
        c+=1
    elif point - int(s[2]) > 0:
        point -= int(s[2])
        w += 1
    else: w+=1
d = len(s[0])-len(ans)
print(c,w,d,point)
# 0180, 2022-02-17 08:10:05, PP- (67%)

s = input().split(',')
ans = input()
point,c,w,d = 0,0,0,0
for i in range(len(ans)):
    if ans[i] == s[0][i]:
        point += int(s[1])
        c+=1
    elif point - int(s[2]) > 0 and ans[i] != '-':
        point -= int(s[2])
        w += 1
    elif ans[i] != '-':
        w+=1
    elif ans[i] == '-':
        d+=1
if len(s[0]) != len(ans):
    d = len(s[0])-len(ans)
print(c,w,d,point)
# 0181, 2022-02-17 08:16:19, PP- (67%)

s = input().split(',')
ans = input()
a = ''
point,c,w,d = 0,0,0,0
for i in range(len(ans)):
    if ans[i] == s[0][i]:
        point += int(s[1])
        c+=1
    elif point - int(s[2]) > 0 and ans[i] != '-':
        point -= int(s[2])
        w += 1
    elif ans[i] != '-':
        w+=1
    elif ans[i] == '-':
        d+=1
if len(s[0]) != len(ans):
   d+= len(s[0])-len(ans)
print(c,w,d,point)
# 0182, 2022-02-17 08:17:11, PPP (100%)

s = input().split(',')
ans = input()
a = ''
point,c,w,d = 0,0,0,0
for i in range(len(ans)):
    if ans[i] == s[0][i]:
        point += int(s[1])
        c+=1
    elif point - int(s[2]) >= 0 and ans[i] != '-':
        point -= int(s[2])
        w += 1
    elif ans[i] != '-':
        w+=1
    elif ans[i] == '-':
        d+=1
if len(s[0]) != len(ans):
   d+= len(s[0])-len(ans)
print(c,w,d,point)


# 0183, 2022-02-17 08:08:51, PPx (67%)

a = input().split(",")
b = input()
b = b + "-"*(len(a)-len(b))
point = 0
t = 0
f = 0
c = 0
for i in range(len(a[0])) :
    if b[i] == a[0][i] :
        point += int(a[1])
        t += 1
    elif b[i] == "-" :
        point += 0
        c += 1
    else :
        point -= int(a[2])
        f += 1
print(t, f, c, point)
# 0184, 2022-02-17 08:10:05, PP- (67%)

a = input().split(",")
b = input()
b = b + "-"*(len(a[0])-len(b))
point = 0
t = 0
f = 0
c = 0
for i in range(len(a[0])) :
    if b[i] == a[0][i] :
        point += int(a[1])
        t += 1
    elif b[i] == "-" :
        point += 0
        c += 1
    else :
        point -= int(a[2])
        f += 1
print(t, f, c, point)
# 0185, 2022-02-17 08:13:13, PP- (67%)

a = input().split(",")
b = input()
b = b + "-"*(len(a[0])-len(b))
point = 0
t = 0
f = 0
c = 0
for i in range(len(a[0])) :
    if b[i] == a[0][i] :
        point += int(a[1])
        t += 1
    elif b[i] == "-" :
        point += 0
        c += 1
    else :
        point -= int(a[2])
        f += 1
print(t, f, c, point)
# 0186, 2022-02-17 08:14:03, PPP (100%)

a = input().split(",")
b = input()
b = b + "-"*(len(a[0])-len(b))
point = 0
t = 0
f = 0
c = 0
for i in range(len(a[0])) :
    if b[i] == a[0][i] :
        point += int(a[1])
        t += 1
    elif b[i] == "-" :
        point += 0
        c += 1
    else :
        point -= int(a[2])
        f += 1
if int(point) < 0 :
    point = "0"
print(t, f, c, point)

# 0187, 2022-02-17 08:11:13, xxx (0%)

x,y,z=input().split(',')
p=input()
z,m,u=0,0,0
for i in range(len(x)):
    if d[i] == '-':
        u+=1
    elif x[i] == p[i]:
        z+=1
    else:
        m+=1
print(z,m,u,(int(y)*z)-(int(z)*m))
# 0188, 2022-02-17 08:14:03, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0189, 2022-02-17 08:14:20, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
  print(true,false,unanswered,score)
# 0190, 2022-02-17 08:14:33, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0191, 2022-02-17 08:10:56, PP- (67%)

s=input().split(",")
a=input()
q=s[0]
sc=0
c=0
w=0
m=0

if len(a)<len(q):
    a+="-"*(len(q)-len(a))

for i in range(len(q)):
    if q[i]==a[i]:
        c+=1
        sc+=int(s[1])
    elif q[i]!=a[i]:
        if a[i]=="T" or a[i]=="F":
            w+=1
            sc-=int(s[2])
        else:
            m+=1
print(c,w,m,sc)
        
# 0192, 2022-02-17 08:14:16, PP- (67%)

s=input().split(",")
a=input()
q=s[0]
sc=0
c=0
w=0
m=0

if len(a)<len(q):
    a+="-"*(len(q)-len(a))

for i in range(len(q)):
    if q[i]==a[i]:
        c+=1
        sc+=int(s[1])
    elif q[i]!=a[i]:
        if a[i]=="T" or a[i]=="F":
            w+=1
            sc-=int(s[2])
        else:
            m+=1
print(c,w,m,sc)
# 0193, 2022-02-17 08:14:56, PP- (67%)

s=input().split(",")
a=input()
q=s[0]
sc=0
c=0
w=0
m=0

if len(a)<len(q):
    a+="-"*(len(q)-len(a))

for i in range(len(q)):
    if q[i]==a[i]:
        c+=1
        sc+=int(s[1])
    else:
        if a[i]=="T" or a[i]=="F":
            w+=1
            sc-=int(s[2])
        else:
            m+=1
print(c,w,m,sc)
# 0194, 2022-02-17 08:16:42, PPP (100%)

s=input().split(",")
a=input()
q=s[0]
sc=0
c=0
w=0
m=0

if len(a)<len(q):
    a+="-"*(len(q)-len(a))

for i in range(len(q)):
    if q[i]==a[i]:
        c+=1
        sc+=int(s[1])
    else:
        if a[i]=="T" or a[i]=="F":
            w+=1
            sc-=int(s[2])
        else:
            m+=1
if sc<0:
    sc=0
print(c,w,m,sc)

# 0195, 2022-02-17 08:11:40, --- (0%)

from pydoc import text


text = input().split(',')
ans = input()
key= text[0]
true = text[1]
false= text[2]
point =0
ch =0
ch_f = 0
ch_n= 0
for i in range(len(ans)):
    if ans[i] == key[i] and key[i]=='T':
        point += int(true)
        ch +=1
    elif ans[i] == key[i] and key[i]=='F':
        point += int(false)
        ch_f+=1
    elif ans[i] == '-':
        ch_n+=1

if point < 0:
    point = 0
    
print(ch,ch_f,ch_n,point)
# 0196, 2022-02-17 08:14:35, --- (0%)

from pydoc import text


text = input().split(',')
ans = input()
key= text[0]
true = text[1]
false= text[2]
point =0
ch =0
ch_f = 0
ch_n= 0
for i in range(len(ans)):
    if ans[i] == key[i] and key[i]=='T':
        point += int(true)
        ch +=1
    elif ans[i] == key[i] and key[i]=='F':
        point -= int(false)
        ch_f+=1
    elif ans[i] == '-':
        ch_n+=1

if point < 0:
    point = 0

print(ch,ch_f,ch_n,point)
# 0197, 2022-02-17 08:15:05, xxx (0%)

pya, b, c = input().split(',')
b = int(b)
c = int(c)
x = input()
correct = 0
wrong = 0
score = 0
for i in range(len(x)):
    if x[i] == a[i]:
        correct = correct + 1
        score = score + b
    elif x[i] != '-' and x[i] != a[i]:
        wrong = wrong + 1
        score = score - c
sum_s = correct * b - wrong * c
if sum_s < 0:
    sum_s = 0

print(correct, wrong, len(a) - correct-wrong, sum_s)
# 0198, 2022-02-17 08:15:26, PPP (100%)

a, b, c = input().split(',')
b = int(b)
c = int(c)
x = input()
correct = 0
wrong = 0
score = 0
for i in range(len(x)):
    if x[i] == a[i]:
        correct = correct + 1
        score = score + b
    elif x[i] != '-' and x[i] != a[i]:
        wrong = wrong + 1
        score = score - c
sum_s = correct * b - wrong * c
if sum_s < 0:
    sum_s = 0

print(correct, wrong, len(a) - correct-wrong, sum_s)

# 0199, 2022-02-17 08:09:32, PP- (67%)

x=input().split(",")
tans=[x[0]]+[int(x[1])]+[int(x[2])]
ans=input()
cc=0
cn=0
cw=0
for i in range(len(ans)):
    if ans[i]==tans[0][i]:
        cc+=1
    elif ans[i]=="-":
        cn+=1
    else:
        cw+=1
pt=(cc*tans[1])-(cw*tans[2])
print(cc,cw,cn,pt)

# 0200, 2022-02-17 08:10:13, PP- (67%)

x=input().split(",")
tans=[x[0]]+[int(x[1])]+[int(x[2])]
ans=input()
cc=0
cn=0
cw=0
for i in range(len(ans)):
    if ans[i]==tans[0][i]:
        cc+=1
    elif ans[i]=="-":
        cn+=1
    else:
        cw+=1
pt=(cc*tans[1])-(cw*tans[2])
if pt <0:
    pt=0
print(cc,cw,cn,pt)

# 0201, 2022-02-17 08:12:00, PP- (67%)

x=input().split(",")
tans=[x[0]]+[int(x[1])]+[int(x[2])]
ans=input()
cc=0
cn=0
cw=0
for i in range(len(ans)):
  if i+1 <= len(ans):
      if ans[i]==tans[0][i]:
          cc+=1
      elif ans[i]=="-":
        cn+=1
      else:
        cw+=1
  else:
    cn+=1
pt=(cc*tans[1])-(cw*tans[2])
if pt <0:
    pt=0
print(cc,cw,cn,pt)
# 0202, 2022-02-17 08:14:10, PPP (100%)

x=input().split(",")
tans=[x[0]]+[int(x[1])]+[int(x[2])]
ans=input()
cc=0
cn=0
cw=0
for i in range(len(ans)):
    if ans[i]==tans[0][i]:
        cc+=1
    elif ans[i]=="-":
        cn+=1
    else:
        cw+=1
pt=(cc*tans[1])-(cw*tans[2])
if pt <0:
    pt=0
cn += len(tans[0])-len(ans)
print(cc,cw,cn,pt)

# 0203, 2022-02-17 08:13:55, xxx (0%)

a = input().split()
b = input()
q = a[0]
c = 0
n = 0
m = 0
for i in range(len[q]):
  if q[i]==b[i]:
    c += 1
  elif q[i]!=b[i]:
    n += 1
  elif b[i]==" " or b[i]=="-":
    m += 1
print(c, n, m, (c*a[1])-n*a[2])
# 0204, 2022-02-17 08:14:56, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0205, 2022-02-17 08:15:06, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0206, 2022-02-17 08:15:21, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0207, 2022-02-17 08:09:31, xxx (0%)

z,y,x=input().split(',')
a=input()
c,w,n=0,0,0
for i in range(len(z)):
    if a[i] == '-':
        n+=1
    elif z[i] == a[i]:
        x+=1
    else:
        w+=1
print(x,w,n,(int(y)*x)-(int(x)*w))
# 0208, 2022-02-17 08:10:19, --x (0%)

z,y,x=input().split(',')
a=input()
x,w,n=0,0,0
for i in range(len(z)):
    if a[i] == '-':
        n+=1
    elif z[i] == a[i]:
        x+=1
    else:
        w+=1
print(x,w,n,(int(y)*x)-(int(x)*w))
# 0209, 2022-02-17 08:14:24, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)

# 0210, 2022-02-17 08:14:36, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)


# 0211, 2022-02-17 08:08:12, xxx (0%)

Key = input().split()
StdData = input()
Plus, Min, Zero = 0, 0, 0
for i in range(len(Key)):
    if StdData[i] == "-": Zero += 1
    elif StdData[i] == Key[0]: Plus += 1
    else: Min += 1
print(Plus, Min, Zero, Plus*int(Key[1]) - Min*int(Key[2]))
# 0212, 2022-02-17 08:09:26, --- (0%)

Key = input().split(",")
StdData = input()
Plus, Min, Zero = 0, 0, 0
for i in range(len(Key)):
    if StdData[i] == "-": Zero += 1
    elif StdData[i] == Key[i]: Plus += 1
    else: Min += 1
print(Plus, Min, Zero, Plus*int(Key[1]) - Min*int(Key[2]))
# 0213, 2022-02-17 08:11:51, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0214, 2022-02-17 08:14:49, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0215, 2022-02-17 08:11:59, PP- (67%)

x=input().split(",")
y=input()
point=0
t=0
f=0
m=0
for i in range(len(y)):
    if x[0][i]==y[i]:
        point+=int(x[1])
        t+=1

    elif y[i]=="-":
        m+=1

    else:
        f+=1
        point-=int(x[2])

print(t,f,m,point)
# 0216, 2022-02-17 08:14:41, PP- (67%)

x=input().split(",")
y=input()
point=0
t=0
f=0
m=0
for i in range(len(y)):
    if x[0][i]==y[i]:
        point+=int(x[1])
        t+=1

    elif y[i]=="-":
        m+=1

    else:
        f+=1
        point-=int(x[2])

if len(x[0]) != len(y):
    m+=abs(len(x[0])-len(y))
print(t,f,m,point)
# 0217, 2022-02-17 08:16:27, xxx (0%)

x = input().split(',')

y = input()

a = x[0]
k = 0
t = 0
f = 0
v = 0

for i in range(a) :
    if y[i] == x[i] and y[i] != '-':
        k += x[1]
        t += 1
        
    elif y[i] != x[i] and y[i] != '-':
        k -= x[2]
        f += 0
for i in range(a) :
    if y[i] == '-' or y[i] == ' ':
        v+=1
    
        
    
        
        
        


print(t,f,v,k)     
        
    




# 0218, 2022-02-17 08:16:41, PPP (100%)

x=input().split(",")
y=input()
point=0
t=0
f=0
m=0
for i in range(len(y)):
    if x[0][i]==y[i]:
        point+=int(x[1])
        t+=1

    elif y[i]=="-":
        m+=1

    else:
        f+=1
        point-=int(x[2])

if len(x[0]) != len(y):
    m+=abs(len(x[0])-len(y))

if point < 0:
    point=0
print(t,f,m,point)


# 0219, 2022-02-17 08:10:17, --x (0%)

a,b,c=input().split(',')
d=input()
c,x,y=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        y+=1
    elif a[i] == d[i]:
        c+=1
    else:
        x+=1
print(c,x,y,(int(b)*c)-(int(c)*x))
# 0220, 2022-02-17 08:11:10, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0221, 2022-02-17 08:13:49, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0222, 2022-02-17 08:14:34, PPP (100%)

a,b,c = input().split(",");b=int(b);c=int(c)
d = input()
e = len(a)
f = len(d)
x = e-f
d = d+("-"*x)
sc = 0
t = 0
f = 0
u = 0
for i in range(e):
    if d[i]==a[i]:
        sc += b
        t += 1
    elif d[i]=="-":
        sc = sc
        u +=1
    elif (d[i]!=a[i]) and (d[i]!="-"):
        sc -= c
        f += 1
if sc < 0:
    sc = 0
print(str(t),str(f),str(u),str(sc))

# 0223, 2022-02-17 08:10:05, xxx (0%)

x=input().split(",")
y=x[0]
z=input()
a=0
b=0
c=0
d=0
for i in range(len(y)):
    if y[i]==z[i]:
        a+=1
        d+=x[1]
    elif y[i]!=z[i]:
        b+=1
        d-=x[2]
    elif z[i]=="-":
        c+=1
print(a, b, c, d)
# 0224, 2022-02-17 08:11:53, P-x (33%)

x=input().split(",")
y=x[0]
z=input()
a=0
b=0
c=0
d=0
for i in range(len(y)):
    if y[i]==z[i]:
        a+=1
        d+=int(x[1])
    elif y[i]!=z[i]:
        b+=1
        d-=int(x[2])
    elif z[i]=="-":
        c+=1
print(a, b, c, d)
# 0225, 2022-02-17 08:14:16, PPx (67%)

x=input().split(",")
y=x[0]
z=input()
a=0
b=0
c=0
d=0
for i in range(len(y)):
    if y[i]==z[i]:
        a+=1
        d+=int(x[1])
    elif z[i]=="-":
        c+=1
    elif y[i]!=z[i] :
        b+=1
        d-=int(x[2])
print(a, b, c, d)
# 0226, 2022-02-17 08:15:42, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0227, 2022-02-17 08:07:36, PP- (67%)

correct_ans,c,w = input().split(',')
ans = input()
c = int(c)
w = int(w)
crr = 0
wr = 0
none = 0
i = 0
for ch in ans:
    if ch == correct_ans[i]:
        crr += 1
    elif ch == '-':
        none += 1
    elif ch != correct_ans[i]:
        wr += 1
    i += 1

no_correct = crr
no_wrong = wr
no_none = none + len(correct_ans) - len(ans)
p = crr*c - wr*w
print(no_correct, no_wrong, no_none, p)
# 0228, 2022-02-17 08:08:36, PPP (100%)

correct_ans,c,w = input().split(',')
ans = input()
c = int(c)
w = int(w)
crr = 0
wr = 0
none = 0
i = 0
for ch in ans:
    if ch == correct_ans[i]:
        crr += 1
    elif ch == '-':
        none += 1
    elif ch != correct_ans[i]:
        wr += 1
    i += 1

no_correct = crr
no_wrong = wr
no_none = none + len(correct_ans) - len(ans)
p = crr*c - wr*w
if p < 0:
    p = 0
print(no_correct, no_wrong, no_none, p)

# 0229, 2022-02-17 08:11:33, PPP (100%)

correct_ans,c,w = input().split(',')
ans = input()
c = int(c)
w = int(w)
crr = 0
wr = 0
none = 0
for i in range(len(ans)):
    if ans[i] == correct_ans[i]:
        crr += 1
    elif ans[i] == '-':
        none += 1
    elif [i] != correct_ans[i]:
        wr += 1

no_correct = crr
no_wrong = wr
no_none = none + len(correct_ans) - len(ans)
p = crr*c - wr*w
if p < 0:
    p = 0
print(no_correct, no_wrong, no_none, p)
# 0230, 2022-02-17 08:16:36, PPP (100%)

correct_ans,c,w = input().split(',')
ans = input()
c = int(c)
w = int(w)
crr = 0
wr = 0
none = 0
for i in range(len(ans)):
    if ans[i] == correct_ans[i]:
        crr += 1
    elif ans[i] == '-':
        none += 1
    elif ans[i] != correct_ans[i]:
        wr += 1

no_correct = crr
no_wrong = wr
no_none = none + len(correct_ans) - len(ans)
p = crr*c - wr*w
if p < 0:
    p = 0
print(no_correct, no_wrong, no_none, p)

# 0231, 2022-02-17 08:06:53, compilation error (0%)

ans,pp,wp = input().split(',')
std = input()
std = std + '-'*abs(len(ans)-len(std))
correct = 0
worng = 0
noans = 0
point = 0 
for i in range(len(ans)) :
  if ans[i] = std[i] :
    correct += 1
    point += int(pp)
  else :
    worng += 1
    point -= int(wp)
  if std[i] = '-' :
    noans += 1
print(correct,worng,noans,point)
# 0232, 2022-02-17 08:07:05, P-- (33%)

ans,pp,wp = input().split(',')
std = input()
std = std + '-'*abs(len(ans)-len(std))
correct = 0
worng = 0
noans = 0
point = 0 
for i in range(len(ans)) :
  if ans[i] == std[i] :
    correct += 1
    point += int(pp)
  else :
    worng += 1
    point -= int(wp)
  if std[i] == '-' :
    noans += 1
print(correct,worng,noans,point)
# 0233, 2022-02-17 08:08:07, P-- (33%)

ans,pp,wp = input().split(',')
std = input()
std = std + '-'*abs(len(ans)-len(std))
correct = 0
worng = 0
noans = 0
point = 0 
for i in range(len(ans)) :
  if ans[i] == std[i] :
    correct += 1
    point += int(pp)
  else :
    worng += 1
    point -= int(wp)
  if std[i] == '-' :
    noans += 1
if point < 0 :
  point = 0

print(correct,worng,noans,point)
# 0234, 2022-02-17 08:11:18, PPP (100%)

ans,pp,wp = input().split(',')
std = input()
std = std + '-'*abs(len(ans)-len(std))
correct = 0
worng = 0
noans = 0
point = 0 
for i in range(len(ans)) :
  if ans[i] == std[i] :
    correct += 1
    point += int(pp)
  elif std[i] != '-' :
    worng += 1
    point -= int(wp)
  else :
    noans += 1
if point < 0 :
  point = 0

print(correct,worng,noans,point)

# 0235, 2022-02-17 08:14:09, PPP (100%)

a, b, c = input().split(",")
ans = input()
b, c = int(b), int(c)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(a) - len(ans))
for i in range(len(a)):
    if a[i] == ans[i]:
        score += b
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif a[i] != ans[i]:
        wrong += 1
        score -= c
print(cor, wrong, didntdo, max(score, 0))
# 0236, 2022-02-17 08:14:49, PPP (100%)

a, b, c = input().split(",")
ans = input()
b, c = int(b), int(c)
score = 0
k, wrong = 0, 0
didntdo = 0
ans += "-" * (len(a) - len(ans))
for i in range(len(a)):
    if a[i] == ans[i]:
        score += b
        k += 1
    elif ans[i] == "-":
        didntdo += 1
    elif a[i] != ans[i]:
        wrong += 1
        score -= c
print(k, wrong, didntdo, max(score, 0))
# 0237, 2022-02-17 08:15:09, PPP (100%)

a, b, c = input().split(",")
ans = input()
b, c = int(b), int(c)
score = 0
k, w = 0, 0
didntdo = 0
ans += "-" * (len(a) - len(ans))
for i in range(len(a)):
    if a[i] == ans[i]:
        score += b
        k += 1
    elif ans[i] == "-":
        didntdo += 1
    elif a[i] != ans[i]:
        w += 1
        score -= c
print(k, w, didntdo, max(score, 0))
# 0238, 2022-02-17 08:16:42, PPP (100%)

a, b, c = input().split(",")
ans = input()
b, c = int(b), int(c)
score = 0
k, w = 0, 0
r = 0
ans += "-" * (len(a) - len(ans))
for i in range(len(a)):
    if a[i] == ans[i]:
        score += b
        k += 1
    elif ans[i] == "-":
        r += 1
    elif a[i] != ans[i]:
        w += 1
        score -= c
print(k, w, r, max(score, 0))

# 0239, 2022-02-17 08:09:30, PP- (67%)

solution = input()
answer = input()
solution, right, wrong = solution.split(',')

score = 0
right_counter = 0
blank_counter = 0
wrong_counter = 0
for i in range(len(answer)):
    if answer[i] == solution[i]:
        score += int(right)
        right_counter += 1
    elif answer[i] == '-':
        score = score
        blank_counter += 1
    elif (answer[i] != solution[i]) and answer[i] != '-':
        score -= int(wrong)
        wrong_counter += 1
print(right_counter, wrong_counter, blank_counter, score)



# 0240, 2022-02-17 08:11:40, PP- (67%)

solution = input()
answer = input()
solution, right, wrong = solution.split(',')

score = 0
right_counter = 0
blank_counter = 0
wrong_counter = 0
for i in range(len(answer)):
    if answer[i] == solution[i]:
        score += int(right)
        right_counter += 1
    elif answer[i] == '-':
        score = score
        blank_counter += 1
    elif (answer[i] != solution[i]) and answer[i] != '-':
        score -= int(wrong)
        wrong_counter += 1
print(right_counter, wrong_counter, blank_counter + len(solution)-len(answer), score)



# 0241, 2022-02-17 08:11:57, PP- (67%)

solution = input()
answer = input()
solution, right, wrong = solution.split(',')

score = 0
right_counter = 0
blank_counter = 0
wrong_counter = 0
for i in range(len(answer)):
    if answer[i] == solution[i]:
        score += int(right)
        right_counter += 1
    elif answer[i] == '-':
        score = score
        blank_counter += 1
    elif (answer[i] != solution[i]) and answer[i] != '-':
        score -= int(wrong)
        wrong_counter += 1
print(right_counter, wrong_counter, blank_counter + len(solution)-len(answer), score)
# 0242, 2022-02-17 08:13:44, PPP (100%)

solution = input()
answer = input()
solution, right, wrong = solution.split(',')

score = 0
right_counter = 0
blank_counter = 0
wrong_counter = 0
for i in range(len(answer)):
    if answer[i] == solution[i]:
        score += int(right)
        right_counter += 1
    elif answer[i] == '-':
        score = score
        blank_counter += 1
    elif (answer[i] != solution[i]) and answer[i] != '-':
        score -= int(wrong)
        wrong_counter += 1
if score < 0:
    score = 0
print(right_counter, wrong_counter, blank_counter + len(solution)-len(answer), score)




# 0243, 2022-02-17 08:08:16, P-x (33%)

from http.cookies import CookieError


sol,cp,wp = input().split(",")
cp = int(cp)
wp = int(wp)
ans = input()
correct = 0
wrong =0 
point = 0
notdo = 0 
for i in range(len(sol)):
    if sol[i] == ans[i]:
        point += cp
        correct += 1
    elif sol[i] != ans[i] and (ans[i] !='-' or i <= len(ans)):
        point -= wp
        wrong += 1
    else:
        notdo += 1
print(correct,wrong,notdo,point)

        

# 0244, 2022-02-17 08:08:44, P-x (33%)

sol,cp,wp = input().split(",")
cp = int(cp)
wp = int(wp)
ans = input()
correct = 0
wrong =0 
point = 0
notdo = 0 
for i in range(len(sol)):
    if sol[i] == ans[i]:
        point += cp
        correct += 1
    elif sol[i] != ans[i] and (ans[i] !='-' or i <= len(ans)):
        point -= wp
        wrong += 1
    else:
        notdo += 1
print(correct,wrong,notdo,point)
# 0245, 2022-02-17 08:11:27, PP- (67%)

sol,cp,wp = input().split(",")
cp = int(cp)
wp = int(wp)
ans = input()
correct = 0
wrong =0 
point = 0
notdo = 0 
if len(ans) != len(sol):
    ans += '-'*(len(sol)-len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i] and ans[i] !='-':
        point += cp
        correct += 1
    elif sol[i] != ans[i] and ans[i] !='-':
        point -= wp
        wrong += 1
    else:
        notdo += 1
print(correct,wrong,notdo,point)

        

# 0246, 2022-02-17 08:12:45, PPP (100%)

sol,cp,wp = input().split(",")
cp = int(cp)
wp = int(wp)
ans = input()
correct = 0
wrong =0 
point = 0
notdo = 0 
if len(ans) != len(sol):
    ans += '-'*(len(sol)-len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i] and ans[i] !='-':
        point += cp
        correct += 1
    elif sol[i] != ans[i] and ans[i] !='-':
        point -= wp
        wrong += 1
    else:
        notdo += 1
if point<0:
    point = 0
print(correct,wrong,notdo,point)

        


# 0247, 2022-02-17 08:10:46, P-x (33%)

s , t ,f = input().split(",")
t = int(t)
f = int(f)
st = input()
c = 0
nt = 0
nf = 0
nd = 0
for i in range(len(s)):
    if s[i] == st[i]:
        c += t
        nt += 1
        
    elif  st[i] == "=":
        c += 0
        nd += 1
    elif s[i] != st[i]:
        c -= f
        nf += 1
    
print(nt,nf,nd,c)

# 0248, 2022-02-17 08:12:47, PPx (67%)

s , t ,f = input().split(",")
t = int(t)
f = int(f)
st = input()
c = 0
nt = 0
nf = 0
nd = 0
for i in range(len(s)):
    if s[i] == st[i]:
        c += t
        nt += 1
        
    elif  st[i] == "-":
        c += 0
        nd += 1
    elif s[i] != st[i]:
        c -= f
        nf += 1
    
print(nt,nf,nd,c)

# 0249, 2022-02-17 08:15:38, PP- (67%)

s , t ,f = input().split(",")
t = int(t)
f = int(f)
st = input()
c = 0
nt = 0
nf = 0
nd = 0
for i in range(len(s)):
    if len(st) != len(s):
        st += "-"
    if s[i] == st[i]:
        c += t
        nt += 1
        
    elif  st[i] == "-":
        c += 0
        nd += 1
    elif s[i] != st[i]:
        c -= f
        nf += 1
    
print(nt,nf,nd,c)

# 0250, 2022-02-17 08:16:15, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0251, 2022-02-17 08:13:10, xxx (0%)

a = input().spilt(',')
use = input()
Ans = a[0]
p_true = int(a[1])
p_false = int(a[2])
point = 0
num_true = 0
num_false = 0
num_non= 0
for i in len(a[0]):
    if use == '-':
        num_non += 1
    elif use == Ans:
        point += p_true
        num_true += 1
    elif use != Ans:
        point -= p_false
        num_false += 1
if point < 0:
    point = 0
print(num_true , num_false , num_non , point)
# 0252, 2022-02-17 08:13:54, xxx (0%)

a = input().split(',')
use = input()
Ans = a[0]
p_true = int(a[1])
p_false = int(a[2])
point = 0
num_true = 0
num_false = 0
num_non= 0
for i in len(a[0]):
    if use == '-':
        num_non += 1
    elif use == Ans:
        point += p_true
        num_true += 1
    elif use != Ans:
        point -= p_false
        num_false += 1
if point < 0:
    point = 0
print(num_true , num_false , num_non , point)
# 0253, 2022-02-17 08:16:18, xxx (0%)

list1 = input().split(",")
s1 = input()
t = 0
f = 0
u = 0
point = 0
for i in range(len(s1)):
  if s1[i] == list1[0][i]:
    t += 1
    p += int(list1[1])
  elif s1[i] == "-":
    u += 1
  else:
    f += 1
    p -= int(list1[2])
u += len(list1[0])-len(s1)
point = max(0,point)

print(t,f,u,point)
# 0254, 2022-02-17 08:16:53, PPP (100%)

list1 = input().split(",")
s1 = input()
t = 0
f = 0
u = 0
point = 0
for i in range(len(s1)):
  if s1[i] == list1[0][i]:
    t += 1
    point += int(list1[1])
  elif s1[i] == "-":
    u += 1
  else:
    f += 1
    point -= int(list1[2])
u += len(list1[0])-len(s1)
point = max(0,point)

print(t,f,u,point)

# 0255, 2022-02-17 08:11:43, xxx (0%)

a,b,c=input().split(',')
d=input()
c,e,f=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,e,f,(int(b)*c)-(int(c)*w))

# 0256, 2022-02-17 08:12:22, --x (0%)

a,b,c=input().split(',')
d=input()
c,e,f=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        f+=1
    elif a[i] == d[i]:
        c+=1
    else:
        e+=1
print(c,e,f,(int(b)*c)-(int(c)*e))
# 0257, 2022-02-17 08:14:44, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
    if yourans[e] == ans[e]:
        true += 1
    elif yourans[e] != '-':
        false += 1
    else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
    if score < 0:
        score = 0
print(true,false,unanswered,score)
# 0258, 2022-02-17 08:15:17, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0259, 2022-02-17 08:09:26, PP- (67%)

in1 = input().split(",")

in2 = input()

right = 0
wrong = 0
notdont = 0
score = 0

for i in range(len(in2)):
	if in2[i] == '-':
		notdont += 1


	elif in1[0][i] == in2[i]:
		right += 1
		score += int(in1[1])
	
	else:
		wrong +=1
		score -= int(in1[2])

print("{} {} {} {}".format(right, wrong, notdont, score))

# 0260, 2022-02-17 08:10:36, PP- (67%)

in1 = input().split(",")

in2 = input()

right = 0
wrong = 0
notdont = len(in1[0]) - len(in2)
score = 0

for i in range(len(in2)):
	if in2[i] == '-':
		notdont += 1


	elif in1[0][i] == in2[i]:
		right += 1
		score += int(in1[1])
	
	else:
		wrong +=1
		score -= int(in1[2])

print("{} {} {} {}".format(right, wrong, notdont, score))


# 0261, 2022-02-17 08:12:17, PPx (67%)

in1 = input().split(",")

in2 = input()

right = 0
wrong = 0
notdont = len(in1[0]) - len(in2)
score = 0

for i in range(len(in2)):
	if in2[i] == '-':
		notdont += 1


	elif in1[0][i] == in2[i]:
		right += 1
		score += int(in1[1])
	
	else:
		wrong +=1
		score -= int(in1[2])

if score < 0:
	score = o

print("{} {} {} {}".format(right, wrong, notdont, score))


# 0262, 2022-02-17 08:12:22, PPP (100%)

in1 = input().split(",")

in2 = input()

right = 0
wrong = 0
notdont = len(in1[0]) - len(in2)
score = 0

for i in range(len(in2)):
	if in2[i] == '-':
		notdont += 1


	elif in1[0][i] == in2[i]:
		right += 1
		score += int(in1[1])
	
	else:
		wrong +=1
		score -= int(in1[2])

if score < 0:
	score = 0

print("{} {} {} {}".format(right, wrong, notdont, score))

# 0263, 2022-02-17 08:08:33, P-- (33%)

int1 = input()
int2 = input()
true , c , f = int1.split(",")
true_l = [x for x in true]
ans_l = [x for x in int2]
cor = 0
wro = 0
for i in range(len(ans_l)):
  if true_l[i] == ans_l[i]:
    cor+=1
  else:
    wro +=1
no = len(true_l)- len(ans_l)
score = (int(cor)*int(c))-(int(wro)*int(f))
print(str(cor)+" "+str(wro)+" "+str(no)+" "+str(score))
# 0264, 2022-02-17 08:10:41, PP- (67%)

int1 = input()
int2 = input()
true , c , f = int1.split(",")
true_l = [x for x in true]
ans_l = [x for x in int2]
cor = 0
wro = 0
no = len(true_l)- len(ans_l)
for i in range(len(ans_l)):
  if ans_l[i]=="-":
    no +=1
  elif true_l[i] == ans_l[i]:
    cor+=1
  else:
    wro +=1
score = (int(cor)*int(c))-(int(wro)*int(f))
print(str(cor)+" "+str(wro)+" "+str(no)+" "+str(score))
# 0265, 2022-02-17 08:12:22, --- (0%)

int1 = input()
int2 = input()
true , c , f = int1.split(",")
true_l = [x for x in true]
ans_l = [x for x in int2]
cor = 0
wro = 0
no = len(true_l)- len(ans_l)
for i in range(len(ans_l)):
  if ans_l[i]=="-":
    no +=1
  elif true_l[i] == ans_l[i]:
    cor+=1
  else:
    wro +=1
score = (int(cor)*int(c))-(int(wro)*int(f))
score = min(0,score)
print(str(cor)+" "+str(wro)+" "+str(no)+" "+str(score))
# 0266, 2022-02-17 08:13:09, PPP (100%)

int1 = input()
int2 = input()
true , c , f = int1.split(",")
true_l = [x for x in true]
ans_l = [x for x in int2]
cor = 0
wro = 0
no = len(true_l)- len(ans_l)
for i in range(len(ans_l)):
  if ans_l[i]=="-":
    no +=1
  elif true_l[i] == ans_l[i]:
    cor+=1
  else:
    wro +=1
score = (int(cor)*int(c))-(int(wro)*int(f))
if score<0:
  score =0
print(str(cor)+" "+str(wro)+" "+str(no)+" "+str(score))

# 0267, 2022-02-17 08:13:13, xxx (0%)

k,e,y = input().split(',')
ans = input()
s,c,o = 0,0,0
for i in range(len(k)):
    if ans[i] == '-':
      o += 1
    elif k[i] == ans[i]:
      y += 1
    else:
      c += 1
print(s,c,o(int(e)*c)-(int(s)*c))
# 0268, 2022-02-17 08:13:44, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0269, 2022-02-17 08:14:24, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)*true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0270, 2022-02-17 08:14:35, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0271, 2022-02-17 08:08:10, --- (0%)

tr,a,b = input().split(",")
fa = input()
c =0
k=0
z=0
x=0
for i in fa:
    if i == tr[k]:
        c += int(a)
        z +=1
        
    if i!= tr[k]:
        c-= int(b)
        x+=1
    k+=1    
print(z,x,c)

# 0272, 2022-02-17 08:12:32, xxx (0%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = tint(cr) - fint(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)

# 0273, 2022-02-17 08:13:39, xxx (0%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = tint(cr) - fint(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)
# 0274, 2022-02-17 08:14:28, PPP (100%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = t*int(cr) - f*int(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)

# 0275, 2022-02-17 08:10:31, PP- (67%)

sol, c, inc = input().strip().split(",")
ans = input().strip()
score = tuk = pid = no = 0;
if len(ans) < len(sol):
    ans += "-" * (len(sol) - len(ans))
for i in range(len(ans)):
    if ans[i] == sol[i]:
        score += int(c)
        tuk += 1
    elif ans[i] != sol[i] and ans[i] != '-':
        score -= int(inc)
        pid += 1
    else:
        no += 1
print(tuk, pid, no, score)
# 0276, 2022-02-17 08:12:10, PPP (100%)

sol, c, inc = input().strip().split(",")
ans = input().strip()
score = tuk = pid = no = 0;
if len(ans) < len(sol):
    ans += "-" * (len(sol) - len(ans))
for i in range(len(ans)):
    if ans[i] == sol[i]:
        score += int(c)
        tuk += 1
    elif ans[i] != sol[i] and ans[i] != '-':
        score -= int(inc)
        pid += 1
    else:
        no += 1
print(tuk, pid, no, max(score, 0))

# 0277, 2022-02-17 08:12:25, PPP (100%)

sol, c, inc = input().strip().split(",")
ans = input().strip()
score = tuk = pid = no = 0;
if len(ans) < len(sol):
    ans += "-" * (len(sol) - len(ans))
for i in range(len(ans)):
    if ans[i] == sol[i]:
        score += int(c)
        tuk += 1
    elif ans[i] != sol[i] and ans[i] != '-':
        score -= int(inc)
        pid += 1
    else:
        no += 1
print(tuk, pid, no, max(score, 0))
# 0278, 2022-02-17 08:12:57, PPP (100%)

sol, c, inc = input().strip().split(",")
ans = input().strip()
score = tuk = pid = no = 0;
if len(ans) < len(sol):
    ans += "-" * (len(sol) - len(ans))
for i in range(len(ans)):
    if ans[i] == sol[i]:
        score += int(c)
        tuk += 1
    elif ans[i] != sol[i] and ans[i] != '-':
        score -= int(inc)
        pid += 1
    else:
        no += 1
print(tuk, pid, no, max(score, 0))


# 0279, 2022-02-17 08:08:05, --- (0%)

correct, ponit_per, minus = input().split(',')
ans = input()

score = 0
wrong = 0
empty = 0
for i in range(len(ans)) :
    if ans[i] == correct[i] :
        score += 1
    elif ans[i] == '-' :
        empty += 1
    else :
        wrong += 1
if (score + empty + wrong) != 5 :
    empty += 5 - (score + empty + wrong)
total = int(ponit_per)*score - int(minus)*wrong
print(score, wrong, empty, total)

# 0280, 2022-02-17 08:10:40, PP- (67%)

correct, ponit_per, minus = input().split(',')
ans = input()

score = 0
wrong = 0
empty = 0
for i in range(len(ans)) :
    if ans[i] == correct[i] :
        score += 1
    elif ans[i] == '-' :
        empty += 1
    else :
        wrong += 1
if (score + empty + wrong) != len(correct) :
    empty += len(correct) - (score + empty + wrong)
total = int(ponit_per)*score - int(minus)*wrong
print(score, wrong, empty, total)

# 0281, 2022-02-17 08:11:32, PPP (100%)

correct, ponit_per, minus = input().split(',')
ans = input()

score = 0
wrong = 0
empty = 0
for i in range(len(ans)) :
    if ans[i] == correct[i] :
        score += 1
    elif ans[i] == '-' :
        empty += 1
    else :
        wrong += 1
if (score + empty + wrong) != len(correct) :
    empty += len(correct) - (score + empty + wrong)
total = int(ponit_per)*score - int(minus)*wrong
if total < 0 :
    total = 0
print(score, wrong, empty, total)


# 0282, 2022-02-17 08:09:58, xxx (0%)

t = input().split(",")
#[TTTFF,"3","1"]
t[1] = int(t[1])
t[2] = int(t[2])
s = input()
s += "-"*((len(t))-len(s))
right = 0
wrong = 0
un = 0
point = 0
for i in range(len(t)[1]) :
    if  s[i] == t[1][i] :
        point += t[1]
        right += 1
    elif s[i] == "-" :
        point += 0
        un += 1
    else :
        point -= t[2]
        wrong += 1

print(right,wrong,un,point)



# 0283, 2022-02-17 08:11:33, PP- (67%)

t = input().split(",")
#[TTTFF,"3","1"]
t[1] = int(t[1])
t[2] = int(t[2])
s = input()
s += "-"*((len(t[0]))-len(s))
right = 0
wrong = 0
un = 0
point = 0
for i in range(len(s)) :
    if  s[i] == t[0][i] :
        point += t[1]
        right += 1
    elif s[i] == "-" :
        point += 0
        un += 1
    else :
        point -= t[2]
        wrong += 1

print(right,wrong,un,point)



# 0284, 2022-02-17 08:13:43, PPP (100%)

t = input().split(",")
#[TTTFF,"3","1"]
t[1] = int(t[1])
t[2] = int(t[2])
s = input()
s += "-"*((len(t[0]))-len(s))
right = 0
wrong = 0
un = 0
point = 0
for i in range(len(s)) :
    if  s[i] == t[0][i] :
        point += t[1]
        right += 1
    elif s[i] == "-" :
        point += 0
        un += 1
    else :
        point -= t[2]
        wrong += 1
if point < 0 :
    point = 0

print(right,wrong,un,point)




# 0285, 2022-02-17 08:10:21, P-- (33%)

a = input().split(',')
c = a[0]
b = input()
i = 0
s = 0
f = 0
t = 0
d = 0
while i < len(b):
    if b[i] == c[i] :
        s += int(a[1])
        t += 1
    elif b[i] != c[i]:
        s -= int(a[2])
        f += 1
    else:
        d += 1
    i += 1
if s < 0:
    s = 0
print(t,f,d,s)

# 0286, 2022-02-17 08:11:41, PP- (67%)

a = input().split(',')
c = a[0]
b = input()
i = 0
s = 0
f = 0
t = 0
d = 0
while i < len(b):
    if b[i] == c[i] :
        s += int(a[1])
        t += 1
    elif b[i] == '-':
        d += 1
    elif b[i] != c[i]:
        s -= int(a[2])
        f += 1
    
    i += 1
if s < 0:
    s = 0
print(t,f,d,s)

# 0287, 2022-02-17 08:13:40, PPP (100%)

a = input().split(',')
c = a[0]
b = input()
i = 0
s = 0
f = 0
t = 0
d = 0
while i < len(b):
    if b[i] == c[i] :
        s += int(a[1])
        t += 1
    elif b[i] == '-':
        d += 1
    elif b[i] != c[i]:
        s -= int(a[2])
        f += 1
    
    i += 1
if s < 0:
    s = 0
if len(b) < len(c):
    d += len(c)-len(b)
print(t,f,d,s)


# 0288, 2022-02-17 08:12:52, PP- (67%)

a = input().split(",")
b = input()

a1 = a[0]
score = 0
cando = 0
cantdo = 0
miss = 0
b = b + "-"*(len(a1)-len(b))
for i in range(len(a1)):
  if a1[i] == b[i]:
    score += int(a[1])
    cando +=1
  elif a1[i] != b[i] and b[i] == "-":
    miss += 1
  elif a1[i] != b[i]:
    score -= int(a[2])
    cantdo +=1
print(cando ,cantdo ,miss ,score)
    

# 0289, 2022-02-17 08:15:17, compilation error (0%)

a = input().split(",")
b = input()

a1 = a[0]
score = 0
cando = 0
cantdo = 0
miss = 0
b = b + "-"*(len(a1)-len(b))
for i in range(len(a1)):
  if a1[i] == b[i]:
    score += int(a[1])
    cando +=1
  elif a1[i] != b[i] and b[i] == "-":
    miss += 1
  elif a1[i] != b[i]:
    score -= int(a[2])
    cantdo +=1
if cando < 0:
  cando =0
if cantdo < 0:
  cantdo =0\
if miss < 0:
  miss =0
if score < 0:
  score =0
print(cando ,cantdo ,miss ,score)
    
# 0290, 2022-02-17 08:15:26, PPP (100%)

a = input().split(",")
b = input()

a1 = a[0]
score = 0
cando = 0
cantdo = 0
miss = 0
b = b + "-"*(len(a1)-len(b))
for i in range(len(a1)):
  if a1[i] == b[i]:
    score += int(a[1])
    cando +=1
  elif a1[i] != b[i] and b[i] == "-":
    miss += 1
  elif a1[i] != b[i]:
    score -= int(a[2])
    cantdo +=1
if cando < 0:
  cando =0
if cantdo < 0:
  cantdo =0
if miss < 0:
  miss =0
if score < 0:
  score =0
print(cando ,cantdo ,miss ,score)

# 0291, 2022-02-17 08:07:55, PPx (67%)

z = input().split(',')
stu = input()
ans = z[0]
c = z[1]
m = z[2]
u = 0
v = 0
n = 0
score = 0
for i in range(len(ans)):
    if stu[i] == ans[i]:
        score += int(c)
        u += 1
    elif stu[i] == '-':
        score += 0
        n += 1
    else:
        score -= int(m)
        v += 1
print(u, v, n, score )
# 0292, 2022-02-17 08:10:59, PP- (67%)

z = input().split(',')
stu = input()
ans = z[0]
c = z[1]
m = z[2]
u = 0
v = 0
n = 0
score = 0
if len(stu) < len(ans):
    stu += '-' * (len(ans) - len(stu))
for i in range(len(ans)):
    if (stu[i] == '-') or (stu[i] == ' '):
        score += 0
        n += 1
    elif stu[i] == ans[i]:
        score += int(c)
        u += 1
    else:
        score -= int(m)
        v += 1
print(u, v, n, score )

# 0293, 2022-02-17 08:12:06, PPP (100%)

z = input().split(',')
stu = input()
ans = z[0]
c = z[1]
m = z[2]
u = 0
v = 0
n = 0
score = 0
if len(stu) < len(ans):
    stu += '-' * (len(ans) - len(stu))
for i in range(len(ans)):
    if (stu[i] == '-') or (stu[i] == ' '):
        score += 0
        n += 1
    elif stu[i] == ans[i]:
        score += int(c)
        u += 1
    else:
        score -= int(m)
        v += 1

if score < 0:
    score = 0
print(u, v, n, score )

# 0294, 2022-02-17 08:13:11, compilation error (0%)

a = input().split(",")
b = input()
x = a[0]
s = 0
r = 0
w = 0
e = 0
for i in range(len(b)):
    if b[i] == x[i]:
        s += int(a[1])
        r += 1
    elif b[i] == "-":
        s += 0
        e += 1
    else:
        s -= int(a[2])
        w += 1
e += (int(len(x)) - int(len(b)))
if s < 0:
    s = 0
print(str(r) + " " + str(w) + " " + str(e) + " " + str(s))TFTTFT,3,1

# 0295, 2022-02-17 08:13:19, PPP (100%)

a = input().split(",")
b = input()
x = a[0]
s = 0
r = 0
w = 0
e = 0
for i in range(len(b)):
    if b[i] == x[i]:
        s += int(a[1])
        r += 1
    elif b[i] == "-":
        s += 0
        e += 1
    else:
        s -= int(a[2])
        w += 1
e += (int(len(x)) - int(len(b)))
if s < 0:
    s = 0
print(str(r) + " " + str(w) + " " + str(e) + " " + str(s))
# 0296, 2022-02-17 08:13:26, PPP (100%)

a = input().split(",")
b = input()
x = a[0]
s = 0
r = 0
w = 0
e = 0
for i in range(len(b)):
    if b[i] == x[i]:
        s += int(a[1])
        r += 1
    elif b[i] == "-":
        s += 0
        e += 1
    else:
        s -= int(a[2])
        w += 1
e += (int(len(x)) - int(len(b)))
if s < 0:
    s = 0
print(str(r) + " " + str(w) + " " + str(e) + " " + str(s))

# 0297, 2022-02-17 08:09:28, PPx (67%)

ans,c,f = [i for i in input().split(',')]
s = input()
count_t = 0
count_f = 0
count_b = 0
for i in range(len(ans)):
    if i > len(s):
        count_b += len(ans) - len(s)
        break
    if ans[i] == s[i]:
        count_t += 1
    elif s[i] == '-':
        count_b += 1
    else:
        count_f += 1
print(count_t, count_f, count_b, count_t*int(c)-count_f*int(f))
# 0298, 2022-02-17 08:11:46, PP- (67%)

ans,c,f = [i for i in input().split(',')]
s = input()
count_t = 0
count_f = 0
count_b = 0
for i in range(len(ans)):
    if i > len(s)-1:
        count_b += len(ans) - len(s)
        break
    if ans[i] == s[i]:
        count_t += 1
    elif s[i] == '-':
        count_b += 1
    else:
        count_f += 1
print(count_t, count_f, count_b, count_t*int(c)-count_f*int(f))

# 0299, 2022-02-17 08:14:06, PPP (100%)

ans,c,f = [i for i in input().split(',')]
s = input()
count_t = 0
count_f = 0
count_b = 0
for i in range(len(ans)):
    if i > len(s)-1:
        count_b += len(ans) - len(s)
        break
    if ans[i] == s[i]:
        count_t += 1
    elif s[i] == '-':
        count_b += 1
    else:
        count_f += 1
a = count_t*int(c)-count_f*int(f)
if a<0:
    a = 0
print(count_t, count_f, count_b, a)

# 0300, 2022-02-17 08:09:00, PPx (67%)

ans = input().split(',')
text = input()
a = len(ans[0])
b = len(text)
ans1 = str(ans[0])
plus = int(ans[1])
minus = int(ans[2])
i = 0
sum1 = 0
cor = 0
wro = 0
no = 0
while i <a:
    if text[i] == '-':
        sum1 += 0
        no += 1
    elif text[i] == ans1[i]:
        sum1 += plus
        cor += 1
    else:
        sum1 -= minus
        wro += 1
    i += 1

print(cor,wro,no,sum1)
# 0301, 2022-02-17 08:11:33, PP- (67%)

ans = input().split(',')
text = input()
a = len(ans[0])
b = len(text)
ans1 = str(ans[0])
plus = int(ans[1])
minus = int(ans[2])
i = 0
sum1 = 0
cor = 0
wro = 0
no = 0
if a != b:
    add = a-b
    no += add
    while i <b:
        if text[i] == '-':
            sum1 += 0
            no += 1
        elif text[i] == ans1[i]:
            sum1 += plus
            cor += 1
        else:
            sum1 -= minus
            wro += 1
        i += 1
else:
    while i <a:
        if text[i] == '-':
            sum1 += 0
            no += 1
        elif text[i] == ans1[i]:
            sum1 += plus
            cor += 1
        else:
            sum1 -= minus
            wro += 1
        i += 1

print(cor,wro,no,sum1)

# 0302, 2022-02-17 08:14:36, PPP (100%)

ans = input().split(',')
text = input()
a = len(ans[0])
b = len(text)
ans1 = str(ans[0])
plus = int(ans[1])
minus = int(ans[2])
i = 0
sum1 = 0
cor = 0
wro = 0
no = 0
if a != b:
    add = a-b
    no += add
    while i <b:
        if text[i] == '-':
            sum1 += 0
            no += 1
        elif text[i] == ans1[i]:
            sum1 += plus
            cor += 1
        else:
            sum1 -= minus
            wro += 1
        i += 1
else:
    while i <a:
        if text[i] == '-':
            sum1 += 0
            no += 1
        elif text[i] == ans1[i]:
            sum1 += plus
            cor += 1
        else:
            sum1 -= minus
            wro += 1
        i += 1
if sum1 < 0:
    sum1 = 0
print(cor,wro,no,sum1)


# 0303, 2022-02-17 08:08:42, PPx (67%)

ans = input().split(',')
stu = input()
i = 0
x = 0
correct = 0
wrong = 0
u =0
for e in ans[0] :
    if e == stu[i]:
        x += int(ans[1])
        correct += 1
    elif stu[i] == '-':
        u += 1
    elif e != stu[i]:
        x -= int(ans[2])
        wrong += 1
    i += 1
if x<0:
    x = 0
print(correct,wrong,u,x)
        
# 0304, 2022-02-17 08:12:24, P-- (33%)

ans = input().split(',')
stu = input()
i = 0
x = 0
correct = 0
wrong = 0
u =0
if len(stu) - len(ans) != 0:
    u += len(ans[0])-len(stu)
for k in range(len(stu)) :
    if ans[0][k] == stu[k]:
        x += int(ans[1])
        correct += 1
    elif stu[i] == '-':
        u += 1
    elif ans[0][k] != stu[k]:
        x -= int(ans[2])
        wrong += 1
if x<0:
    x = 0
print(correct,wrong,u,x)
        
# 0305, 2022-02-17 08:13:46, PPP (100%)

ans = input().split(',')
stu = input()
i = 0
x = 0
correct = 0
wrong = 0
u =0
if len(stu) - len(ans) != 0:
    u += len(ans[0])-len(stu)
for k in range(len(stu)) :
    if ans[0][k] == stu[k]:
        x += int(ans[1])
        correct += 1
    elif stu[k] == '-':
        u += 1
    elif ans[0][k] != stu[k]:
        x -= int(ans[2])
        wrong += 1
if x<0:
    x = 0
print(correct,wrong,u,x)
        

# 0306, 2022-02-17 08:13:24, compilation error (0%)

a = input().split(',')
b = input()

x = int(a[-1])
y = int(a[-2])


t = 0
f = 0
n = 0
m = 0

for i in range (len(b)):
    if b(i-1:i:1) == '-':
        n+=1
    if a(i-1:i:1) == b(i-1:i:1):
        m+=x
        t+=1
    else:
        m-=y
        f+=1
print(t,f,n,m)
# 0307, 2022-02-17 08:14:51, compilation error (0%)

a = input().split(',')
b = input()

x = int(a[-1])
y = int(a[-2])


t = 0
f = 0
n = 0
m = 0

for i in range (len(b)):
#     if b(i-1:i:1) == '-':
#         n+=1
#     if a(i-1:i:1) == b(i-1:i:1):
#         m+=x
#         t+=1
#     else:
#         m-=y
#         f+=1
print(t,f,n,m)

# 0308, 2022-02-17 08:16:10, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0309, 2022-02-17 08:12:58, PP- (67%)

key, correct_points, wrong_points = [e for e in input().split(',')]
answer = input()
scores = 0
correct_answers = 0
wrong_answers = 0
no_answer = 0
i = 0
while i < len(answer):
    if answer[i] == '-':
        no_answer += 1
    elif answer[i] == key[i]:
        scores += int(correct_points)
        correct_answers += 1
    else:
        scores -= int(wrong_points)
        wrong_answers += 1
    i += 1
if len(answer) != len(key):
    no_answer += len(key) - len(answer)
print(correct_answers, wrong_answers, no_answer, scores)
# 0310, 2022-02-17 08:15:18, --- (0%)

key, correct_points, wrong_points = [e for e in input().split(',')]
answer = input()
scores = 0
correct_answers = 0
wrong_answers = 0
no_answer = 0
i = 0
while i < len(answer):
    if answer[i] == '-':
        no_answer += 1
    elif answer[i] == key[i]:
        correct_answers += 1
    else:
        wrong_answers += 1
    i += 1
if len(answer) != len(key):
    no_answer += len(key) - len(answer)
scores -= int(wrong_points)*correct_answers
scores += int(correct_points)*wrong_answers
print(correct_answers, wrong_answers, no_answer, scores)
# 0311, 2022-02-17 08:17:22, PPP (100%)

key, correct_points, wrong_points = [e for e in input().split(',')]
answer = input()
scores = 0
correct_answers = 0
wrong_answers = 0
no_answer = 0
i = 0
while i < len(answer):
    if answer[i] == '-':
        no_answer += 1
    elif answer[i] == key[i]:
        scores += int(correct_points)
        correct_answers += 1
    else:
        scores -= int(wrong_points)
        wrong_answers += 1
    i += 1
if len(answer) != len(key):
    no_answer += len(key) - len(answer)
if scores<0:
    scores = 0
print(correct_answers, wrong_answers, no_answer, scores)

# 0312, 2022-02-17 08:11:08, xxx (0%)

a,b,c=input().split(',')
x=input()
t,f,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == x[i]:
        t+=1
    else:
        f+=1
print(t,f,n,(int(b)*t)-(int(t)*f))
# 0313, 2022-02-17 08:12:49, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0314, 2022-02-17 08:14:37, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0315, 2022-02-17 08:13:49, PP- (67%)

question,correct,wrong = [str(e) for e in input().split(",")]
correct = int(correct)
wrong = int(wrong)
answer = input()
points = 0
corrects = 0
wrongs = 0
nones = 0
if len(answer) < len(question):
    answer += '-'*(len(question)-len(answer))
for i in range(len(question)):
    if answer[i] == question[i]:
        points += correct
        corrects += 1
    elif (answer[i] == '-') or (answer[i] == ''):
        nones += 1
    else:
        points -= wrong
        wrongs += 1
print(corrects, wrongs, nones, points)

# 0316, 2022-02-17 08:15:46, compilation error (0%)

question,correct,wrong = [str(e) for e in input().split(",")]
correct = int(correct)
wrong = int(wrong)
answer = input()
points = 0
corrects = 0
wrongs = 0
nones = 0
if len(answer) < len(question):
    answer += '-'*(len(question)-len(answer))
for i in range(len(question)):
    if answer[i] == question[i]:
        points += correct
        corrects += 1
    elif (answer[i] == '-') or (answer[i] == ''):
        nones += 1
    else:
        points -= wrong
        wrongs += 1
if points < 0:
points = 0
print(corrects, wrongs, nones, points)
# 0317, 2022-02-17 08:16:01, PPP (100%)

question,correct,wrong = [str(e) for e in input().split(",")]
correct = int(correct)
wrong = int(wrong)
answer = input()
points = 0
corrects = 0
wrongs = 0
nones = 0
if len(answer) < len(question):
    answer += '-'*(len(question)-len(answer))
for i in range(len(question)):
    if answer[i] == question[i]:
        points += correct
        corrects += 1
    elif (answer[i] == '-') or (answer[i] == ''):
        nones += 1
    else:
        points -= wrong
        wrongs += 1
if points < 0:
    points = 0
print(corrects, wrongs, nones, points)

# 0318, 2022-02-17 08:11:32, xxx (0%)

a=input().split(',')
b=input().split(',')
c=input().split(',')
d=input()
c=0
w=0
n=0
for i in range(len(a)):
    if d[i] == '-':
        n = n +1 
    elif a[i] == d[i]:
        c = c +1
    else:
        w = w+1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0319, 2022-02-17 08:12:52, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))   

# 0320, 2022-02-17 08:14:55, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0321, 2022-02-17 08:14:14, --- (0%)

a= input().split(",")
b= input()
c= 0#ข้อถูก
f= 0#ข้อที่ไม่ได้ทำ

l= 0#ช้อผิด
for i in range(len(a)):
    if b[i]== a[i]:
        c= c+1
    else:
        if b[i]== "-":
            f= f+1
        else:
            l=l+1
e= len(a)-c-f-l #ข้อที่ไม่ได้ทำ
k= int(a[-2])*c-int(a[-1])
print(c,l,f,k)

# 0322, 2022-02-17 08:14:17, --- (0%)

a= input().split(",")
b= input()
c= 0#ข้อถูก
f= 0#ข้อที่ไม่ได้ทำ

l= 0#ช้อผิด
for i in range(len(a)):
    if b[i]== a[i]:
        c= c+1
    else:
        if b[i]== "-":
            f= f+1
        else:
            l=l+1
e= len(a)-c-f-l #ข้อที่ไม่ได้ทำ
k= int(a[-2])*c-int(a[-1])
print(c,l,f,k)
# 0323, 2022-02-17 08:15:19, PPP (100%)

a, b, c = input().split(',')
b = int(b)
c = int(c)
x = input()
correct = 0
wrong = 0
score = 0
for i in range(len(x)):
    if x[i] == a[i]:
        correct = correct + 1
        score = score + b
    elif x[i] != '-' and x[i] != a[i]:
        wrong = wrong + 1
        score = score - c
sum_s = correct * b - wrong * c
if sum_s < 0:
    sum_s = 0

print(correct, wrong, len(a) - correct-wrong, sum_s)


# 0324, 2022-02-17 08:03:50, PPx (67%)

x=input().split(',')
y=input()
c=int(x[1])
w=int(x[2])
s=0
t=0
a=0
b=0
for i in range(len(x[0])):
    if x[0][i]==y[i]:
        s+=c
        t+=1
    elif y[i]!='-':
        s-=w
        a+=1
    else:
        b+=1
print(t,a,b,s)
        
    

# 0325, 2022-02-17 08:05:12, PP- (67%)

x=input().split(',')
y=input()
c=int(x[1])
w=int(x[2])
y+='-'*(len(x[0])-len(y))
s=0
t=0
a=0
b=0
for i in range(len(x[0])):
    if x[0][i]==y[i]:
        s+=c
        t+=1
    elif y[i]!='-':
        s-=w
        a+=1
    else:
        b+=1
print(t,a,b,s)
        
    

# 0326, 2022-02-17 08:05:53, PPP (100%)

x=input().split(',')
y=input()
c=int(x[1])
w=int(x[2])
y+='-'*(len(x[0])-len(y))
s=0
t=0
a=0
b=0
for i in range(len(x[0])):
    if x[0][i]==y[i]:
        s+=c
        t+=1
    elif y[i]!='-':
        s-=w
        a+=1
    else:
        b+=1
if s<0:
    s=0
print(t,a,b,s)
        
    


# 0327, 2022-02-17 08:13:40, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0328, 2022-02-17 08:14:44, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0329, 2022-02-17 08:15:24, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0330, 2022-02-17 08:11:32, P-- (33%)

x,c,w=input().split(',')
ans=input()
correct=0
worng=0
empty=len(x)-len(ans)
for i in range(len(ans)):
    if x[i]==ans[i]:
        correct+=1
    elif x[i]!=ans[i] and ans[i]!='-':
        worng+=1
    elif ans[i]=='-':
        empty+=1
    
print(correct,worng,empty,correct*int(c)+worng*int(w))
# 0331, 2022-02-17 08:12:18, PP- (67%)

x,c,w=input().split(',')
ans=input()
correct=0
worng=0
empty=len(x)-len(ans)
for i in range(len(ans)):
    if x[i]==ans[i]:
        correct+=1
    elif x[i]!=ans[i] and ans[i]!='-':
        worng+=1
    elif ans[i]=='-':
        empty+=1
    
print(correct,worng,empty,correct*int(c)-worng*int(w))
# 0332, 2022-02-17 08:13:43, PPP (100%)

x,c,w=input().split(',')
ans=input()
correct=0
worng=0
empty=len(x)-len(ans)
for i in range(len(ans)):
    if x[i]==ans[i]:
        correct+=1
    elif x[i]!=ans[i] and ans[i]!='-':
        worng+=1
    elif ans[i]=='-':
        empty+=1
    
if correct*int(c)-worng*int(w) <0:
  print(correct,worng,empty,0)
else:
  print(correct,worng,empty,correct*int(c)-worng*int(w))

# 0333, 2022-02-17 08:15:01, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0334, 2022-02-17 08:15:45, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)
# 0335, 2022-02-17 08:15:51, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0336, 2022-02-17 08:05:59, xxx (0%)

ans, score, minus = input().split()
score, minus = int(score), int(minus)
in_ans = input()
sum_score = 0
correct = 0
wrong = 0
for i in range(len(in_ans)):
    if in_ans[i] == ans[i]:
        correct += 1
    elif in_ans[i] != '-':
        wrong += 1
print(correct, wrong, len(ans) - correct-wrong, correct * score - wrong * minus)
# 0337, 2022-02-17 08:07:03, PP- (67%)

ans, score, minus = input().split(',')
score, minus = int(score), int(minus)
in_ans = input()
sum_score = 0
correct = 0
wrong = 0
for i in range(len(in_ans)):
    if in_ans[i] == ans[i]:
        correct += 1
    elif in_ans[i] != '-':
        wrong += 1
print(correct, wrong, len(ans) - correct-wrong, correct * score - wrong * minus)
# 0338, 2022-02-17 08:08:18, PPP (100%)

ans, score, minus = input().split(',')
score, minus = int(score), int(minus)
in_ans = input()
sum_score = 0
correct = 0
wrong = 0
for i in range(len(in_ans)):
    if in_ans[i] == ans[i]:
        correct += 1
    elif in_ans[i] != '-':
        wrong += 1
sum_score = max(0,correct * score - wrong * minus)

print(correct, wrong, len(ans) - correct-wrong, sum_score)

# 0339, 2022-02-17 08:07:46, xxx (0%)

s = input().split(',')
key = s[0]
points = int(s[1])
fas = int(s[2])
ans = input()
ans += + "-"*(len(key)-len(ans))

cor_num = 0
fas_num = 0
non = 0
gp = 0


i = 0
while i < len(key):
    if key[i] == ans[i]:
        cor_num += 1
        gp += points
    elif ans[i] == '-':
        non += 1
    else:
        fas_num += 1
        gp += -fas
    i += 1

print(cor_num, fas_num, non, gp)
# 0340, 2022-02-17 08:08:37, PP- (67%)

s = input().split(',')
key = s[0]
points = int(s[1])
fas = int(s[2])
ans = input()
ans +=  "-"*(len(key)-len(ans))

cor_num = 0
fas_num = 0
non = 0
gp = 0


i = 0
while i < len(key):
    if key[i] == ans[i]:
        cor_num += 1
        gp += points
    elif ans[i] == '-':
        non += 1
    else:
        fas_num += 1
        gp += -fas
    i += 1

print(cor_num, fas_num, non, gp)
# 0341, 2022-02-17 08:10:36, PPP (100%)

s = input().split(',')
key = s[0]
points = int(s[1])
fas = int(s[2])
ans = input()
ans +=  "-"*(len(key)-len(ans))

cor_num = 0
fas_num = 0
non = 0
gp = 0


i = 0
while i < len(key):
    if key[i] == ans[i]:
        cor_num += 1
        gp += points
    elif ans[i] == '-':
        non += 1
    else:
        fas_num += 1
        gp += -fas
    i += 1

if gp < 0:
    gp = 0

print(cor_num, fas_num, non, gp)

# 0342, 2022-02-17 08:12:31, PP- (67%)

sol,c,f = input().split(',')
c = int(c)
cc = 0
f = int(f)
ff = 0
bb = 0
ans = input()
score = 0
for i in range(len(sol)):
    if i < len(ans):
        if ans[i] == sol[i]:
            score += c
            cc += 1
        elif ans[i] == ' ' or ans[i] == '-':
            bb += 1
        else:
            score -= f
            ff += 1
    else:
        bb+=1
print(cc,ff,bb,score)
# 0343, 2022-02-17 08:13:52, PP- (67%)

sol,c,f = input().split(',')
c = int(c)
cc = 0
f = int(f)
ff = 0
bb = 0
ans = input()
score = 0
for i in range(len(sol)):
    if i < len(ans):
        if ans[i] == sol[i]:
            score += c
            cc += 1
        elif ans[i] == '-':
            bb += 1
        else:
            score -= f
            ff += 1
    else:
        bb+=1
print(cc,ff,bb,score)
# 0344, 2022-02-17 08:14:34, PPP (100%)

ans,t,f=input().split(",")
reply=input().strip()
t=int(t)
f=int(f)
tc=0
fc=0
blank=0
score=0
for i in range(len(reply)):
    if reply[i]==ans[i]:
        score+=t
        tc+=1
    elif reply[i]=="-":
        blank+=1
    else :
        score-=f
        fc+=1
if score<0:
    score=0
if len(reply)<len(ans):
    blank+=len(ans)-len(reply)
print(tc,fc,blank,score)


# 0345, 2022-02-17 08:09:51, P-- (33%)

x = input().split(',')
v = input()
a = str(x[0])
s = 0
t = 0
f = 0
for i in range(len(v)) :
    if v[i] == a[i] :
        s += int(x[1])
        t +=1
    elif v[i] != a[i] :
        s -= int(x[2])
        f += 1
print(t,f,len(a)-len(v),s)
# 0346, 2022-02-17 08:15:29, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0347, 2022-02-17 08:16:07, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0348, 2022-02-17 08:06:57, PPx (67%)

score = 0
sol = input().split(',')
ans = input()
i = 0
correct = 0
wrong = 0
noans = 0
for e in sol[0]:
    if e == ans[i]:
        score += int(sol[1])
        correct += 1
    elif ans[i] == '-':
        noans += 1
    else:
        score -= int(sol[2])
        wrong += 1
    i += 1
print(correct, wrong, noans, score)
# 0349, 2022-02-17 08:11:57, PP- (67%)

score = 0
sol = input().split(',')
ans = input()
i = 0
correct = 0
wrong = 0
noans = 0
for e in sol[0]:
    if i >= len(ans):
        noans += (len(sol[0]) - len(ans))
        break
    if e == ans[i]:
        score += int(sol[1])
        correct += 1
    elif ans[i] == '-':
        noans += 1
    else:
        score -= int(sol[2])
        wrong += 1
    i += 1
print(correct, wrong, noans, score)
# 0350, 2022-02-17 08:14:26, PPP (100%)

score = 0
sol = input().split(',')
ans = input()
i = 0
correct = 0
wrong = 0
noans = 0
for e in sol[0]:
    if i >= len(ans):
        noans += (len(sol[0]) - len(ans))
        break
    if e == ans[i]:
        score += int(sol[1])
        correct += 1
    elif ans[i] == '-':
        noans += 1
    else:
        score -= int(sol[2])
        wrong += 1
    i += 1
if score < 0:
    score = 0
print(correct, wrong, noans, score)


# 0351, 2022-02-17 08:09:06, PP- (67%)

ans = input().split(',')
q = input()
pk = 0
ck = 0
cant = 0
ff = 0
for e in range(len(q)):
    if ans[0][e] == q[e]:
        pk += int(ans[1])
        ck += 1
    elif q[e] == '-':
        cant += 1
    else:
        pk -= int(ans[2])
        ff += 1

print(ck,ff,cant,pk)
# 0352, 2022-02-17 08:12:19, compilation error (0%)

ans = input().split(',')
q = input()
pk = 0
ck = 0
cant = 0
ff = 0
for e in range(len(q)):
    if q[e] == '-':
        cant += 1
    elif ans[0][e] == q[e]:
        pk += int(ans[1])
        ck += 1
    else:
        pk -= int(ans[2])
        ff += 1
if pk<0:
    pk = 0
print(ck,ff,cant+(len(ans[0])-len(q)),pk))
# 0353, 2022-02-17 08:13:10, PPP (100%)

ans = input().split(',')
q = input()
pk = 0
ck = 0
cant = 0
ff = 0
for e in range(len(q)):
    if q[e] == '-':
        cant += 1
    elif ans[0][e] == q[e]:
        pk += int(ans[1])
        ck += 1
    else:
        pk -= int(ans[2])
        ff += 1
if pk<0:
    pk = 0
print(ck,ff,cant+(len(ans[0])-len(q)),pk)

# 0354, 2022-02-17 08:13:24, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0355, 2022-02-17 08:13:42, PP- (67%)

a,p,m = input().split(',')
s = input()
i,f,c,w,k = 0,0,0,0,0
for ch in s:
    if ch == a[i]:
        f += int(p)
        c += 1
    elif ch == '-':
        k +=1
    else:
        f -= int(m)
        w +=1
    i += 1
k += len(a) - i
print(c,w,k,f)
# 0356, 2022-02-17 08:16:07, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0357, 2022-02-17 08:08:39, PP- (67%)

lste = input().split(',')
lsta = list(input())
lsts = list(lste[0])
r = 0
w = 0
n = 0
for i in range(len(lsta)):
  if lsta[i] == "-":
    n += 1
  elif lsta[i] == lsts[i]:
    r += 1
  else:
    w += 1
score = r*int(lste[1]) - w*int(lste[2])
print(str(r) + " " + str(w) + " " + str(n) + " " + str(score))
# 0358, 2022-02-17 08:11:03, PP- (67%)

lste = input().split(',')
lsta = list(input())
lsts = list(lste[0])
r = 0
w = 0
n = 0
while len(lsta) < len(lsts):
  lsta.append("-")
for i in range(len(lsta)):
  if lsta[i] == "-":
    n += 1
  elif lsta[i] == lsts[i]:
    r += 1
  elif lsta[i] != lsts[i]:
    w += 1
score = r*int(lste[1]) - w*int(lste[2])
print(str(r) + " " + str(w) + " " + str(n) + " " + str(score))
# 0359, 2022-02-17 08:13:06, PPP (100%)

lste = input().split(',')
lsta = list(input())
lsts = list(lste[0])
r = 0
w = 0
n = 0
while len(lsta) < len(lsts):
  lsta.append("-")
for i in range(len(lsta)):
  if lsta[i] == "-":
    n += 1
  elif lsta[i] == lsts[i]:
    r += 1
  elif lsta[i] != lsts[i]:
    w += 1
score = r*int(lste[1]) - w*int(lste[2])
if score <= 0:
  score = 0
print(str(r) + " " + str(w) + " " + str(n) + " " + str(score))

# 0360, 2022-02-17 08:14:50, xxx (0%)

one,two,three = input().split(',')
ans = input()
two = int(one)
three = int(three)
what = 0 ; one1 = 0 ; two2 = 0 ;three3 = 0

for i in range(len(one)) :
    
  if one[i] == ans[i] :
    what += two
    one1 += 1
    
  elif one[i] != ans[i] :
    if check[i] == '-':
      three3 += 1
      
    else:
      two2 += 0
      
print(one1, two2, three3, what)
# 0361, 2022-02-17 08:15:08, --x (0%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if ans[i] == check[i] :
    score += cor
    c += 1
  elif ans[i] != check[i] :
    if check[i] == '-':
      d += 1
    else:
      w += 0
print(c, w, d, score)
# 0362, 2022-02-17 08:15:42, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0363, 2022-02-17 08:13:00, compilation error (0%)

key=[i for i in input().split(,)]
ans=input()
score = 0
if len(ans) == len(key):
    for i in range (len(ans)):
        if ans[i]==key[i]: 
            score+=int(key[1])
    print(score)
if len(ans)>len(key)

# 0364, 2022-02-17 08:16:31, xxx (0%)

s,t,f=input().split(',')
T=int(t)
F=int(f)
ans=input()
sum=0
true=0
false=0
notdo=len(s)-len(ans)
for i in range(len(ans)):
    if ans[i]=='-':
        notdo+=1
    elif s[i]==ans[i]:
        sum+= t
        true+=1
    elif s[i]!=ans[i]:
        sum-=f
        false+=1
if sum<0:
    sum=0
print(true,false,notdo,sum)
# 0365, 2022-02-17 08:16:41, PPP (100%)

s,t,f=input().split(',')
t=int(t)
f=int(f)
ans=input()
sum=0
true=0
false=0
notdo=len(s)-len(ans)
for i in range(len(ans)):
    if ans[i]=='-':
        notdo+=1
    elif s[i]==ans[i]:
        sum+= t
        true+=1
    elif s[i]!=ans[i]:
        sum-=f
        false+=1
if sum<0:
    sum=0
print(true,false,notdo,sum)

# 0366, 2022-02-17 08:11:09, PPx (67%)

x = input().split(",")
ans = str(input())

c1 = 0
c2 = 0
c3 = 0

for i in range(len(x[0])):
  if ans[i]==(x[0])[i]:
    c1 += 1
  elif ans[i]=='-':
    c3 += 1
  elif ans[i]!=(x[0])[i]:
    c2 += 1

c = ( c1*int(x[1]) ) - ( c2*int(x[2]) )

print(c1,c2,c3,c)
# 0367, 2022-02-17 08:15:04, PP- (67%)

x = input().split(",")
ans = str(input())

c1 = 0
c2 = 0
c3 = 0

if len(ans)!=len(x[0]):
  ans = ans+('-'*(len(x[0])-len(ans)))

for i in range(len(x[0])):
  if ans[i]==(x[0])[i]:
    c1 += 1
  elif ans[i]=='-':
    c3 += 1
  elif ans[i]!=(x[0])[i]:
    c2 += 1

c = ( c1*int(x[1]) ) - ( c2*int(x[2]) )

print(c1,c2,c3,c)
# 0368, 2022-02-17 08:15:24, PPP (100%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = t*int(cr) - f*int(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)

# 0369, 2022-02-17 08:05:22, PP- (67%)

t,g,l = input().split(',')
s = input()
g = int(g)
l = int(l)
grade = 0
c =0
w=0
lose = 0
for i in range(len(s)):
    if s[i] =='-':
        lose+=1
    elif s[i] == t[i]:
        c+=1
    else:
        w+=1
lose += len(t) -len(s)

print(c,w,lose,c*g - w*l)
# 0370, 2022-02-17 08:05:47, PPP (100%)

t,g,l = input().split(',')
s = input()
g = int(g)
l = int(l)
grade = 0
c =0
w=0
lose = 0
for i in range(len(s)):
    if s[i] =='-':
        lose+=1
    elif s[i] == t[i]:
        c+=1
    else:
        w+=1
lose += len(t) -len(s)

print(c,w,lose,max(0,c*g - w*l))
# 0371, 2022-02-17 08:10:49, PPP (100%)

t,g,l = input().split(',')
s = input()
g = int(g)
l = int(l)
grade = 0
c =0
w=0
lose = 0
for i in range(len(s)):
    if s[i] =='-':
        lose+=1
    elif s[i] == t[i]:
        c+=1
    else:
        w+=1
lose += max(len(t) -len(s),0)

print(c,w,lose,max(0,c*g - w*l))

# 0372, 2022-02-17 08:10:30, PP- (67%)

key=input().split(",")
ans=input()
count =0
count2 =0
count3 =0
point =0
for i in range(len(ans)):
  if key[0][i]==ans[i]:
    count+=1
    point += int(key[1])
  elif ans[i] == '-':
    count3+=1
  else:
    count2 += 1
    point -= int(key[2])
print(count,count2,count3,point)
# 0373, 2022-02-17 08:11:56, PP- (67%)

key=input().split(",")
ans=input()
count =0
count2 =0
count3 =0
point =0
for i in range(len(ans)):
  if key[0][i]==ans[i]:
    count+=1
    point += int(key[1])
  elif ans[i] == '-':
    count3+=1
  else:
    count2 += 1
    point -= int(key[2])
if point < 0:
  point=0
print(count,count2,count3,point)
# 0374, 2022-02-17 08:12:43, PPP (100%)

key=input().split(",")
ans=input()
count =0
count2 =0
count3 =len(key[0])-len(ans)
point =0
for i in range(len(ans)):
  if key[0][i]==ans[i]:
    count+=1
    point += int(key[1])
  elif ans[i] == '-':
    count3+=1
  else:
    count2 += 1
    point -= int(key[2])
if point < 0:
  point=0
print(count,count2,count3,point)

# 0375, 2022-02-17 08:13:35, PP- (67%)

a,t,f = input().split(",")
x = input()

c = 0
l = 0
z = 0

for k in range(len(x)) :
    if k == len(x) :
        break
    elif x[k] == "-" :
        z += 1
    elif x[k] == a[k] :
        c += 1
    else :
        l += 1
        
print(c,l,len(a) - len(x) + z,c*int(t) - l*int(f))
    

    
print()


    
    
    

# 0376, 2022-02-17 08:15:16, PPP (100%)

a,t,f = input().split(",")
x = input()

c = 0
l = 0
z = 0

for k in range(len(x)) :
    if k == len(x) :
        break
    elif x[k] == "-" :
        z += 1
    elif x[k] == a[k] :
        c += 1
    else :
        l += 1

if (c*int(t) - l*int(f)) >= 0 :
    print(c,l,len(a) - len(x) + z,c*int(t) - l*int(f))
else :
    print(c,l,len(a) - len(x) + z,"0")
    

    
print()


    
    
    

# 0377, 2022-02-17 08:17:29, PPP (100%)

a,t,f = input().split(",")
x = input()

c = 0
l = 0
z = 0

for k in range(len(x)) :
    if k == len(x) :
        break
    elif x[k] == "-" :
        z += 1
    elif x[k] == a[k] :
        c += 1
    else :
        l += 1

if (c*int(t) - l*int(f)) >= 0 :
    print(c,l,len(a) - len(x) + z,c*int(t) - l*int(f))
else :
    print(c,l,len(a) - len(x) + z,"0")
    

    

# 0378, 2022-02-17 08:15:09, xxx (0%)

n = input().split(',')
x = str(n[0])
guess = input()
a = 0
b = 0
c = 0
p = 0
for i in range(len(X)):
    if p < 0:
        break
    if guess[i] == x[i]:
        p += int(n[1])
        a += 1
    elif guess[i] != x[i] and guess[i] != '-':
        p -= int(n[2])
        b += 1
    elif guess[i] == '-':
        p += 0
        c += 1
print(a,b,c,p)

# 0379, 2022-02-17 08:15:22, xxx (0%)

n = input().split(',')
x = str(n[0])
guess = input()
a = 0
b = 0
c = 0
p = 0
for i in range(len(X)):
    if guess[i] == x[i]:
        p += int(n[1])
        a += 1
    elif guess[i] != x[i] and guess[i] != '-':
        p -= int(n[2])
        b += 1
    elif guess[i] == '-':
        p += 0
        c += 1
print(a,b,c,p)
# 0380, 2022-02-17 08:15:44, PPP (100%)

a,t,f = input().split(",")
x = input()

c = 0
l = 0
z = 0

for k in range(len(x)) :
    if k == len(x) :
        break
    elif x[k] == "-" :
        z += 1
    elif x[k] == a[k] :
        c += 1
    else :
        l += 1

if (c*int(t) - l*int(f)) >= 0 :
    print(c,l,len(a) - len(x) + z,c*int(t) - l*int(f))
else :
    print(c,l,len(a) - len(x) + z,"0")
    

    
print()

# 0381, 2022-02-17 08:10:12, PPx (67%)

x = input().split(",")
ans=x[0]
ifc=int(x[1])
ifw=int(x[2])
na=0
ca=0
wa=0
ans = [char for char in ans]
myans = [char for char in input()]
for i in range(len(ans)):
    if ans[i]==myans[i]:
        ca+=1
    elif myans[i]=='-':
        na+=1
    else:
        wa+=1
po=(ca*ifc)-(wa*ifw)
print(ca,wa,na,po)

# 0382, 2022-02-17 08:11:53, PPx (67%)

x = input().split(",")
ans=x[0]
ifc=int(x[1])
ifw=int(x[2])
na=0
ca=0
wa=0
ans = [char for char in ans]
myans = [char for char in input()]
for i in range(len(ans)):
    if ans[i]==myans[i]:
        ca+=1
    elif myans[i]=='-':
        na+=1
    else:
        wa+=1
po=(ca*ifc)-(wa*ifw)
if po<0:
    po=0
print(ca,wa,na,po)

# 0383, 2022-02-17 08:14:08, PPP (100%)

x = input().split(",")
ans=x[0]
ifc=int(x[1])
ifw=int(x[2])
na=0
ca=0
wa=0
ans = [char for char in ans]
myans = [char for char in input()]
while len(ans)!=len(myans):
    myans+=['']

for i in range(len(ans)):
    if ans[i]==myans[i]:
        ca+=1
    elif myans[i]=='-' or myans[i]=='':
        na+=1
    else:
        wa+=1
po=(ca*ifc)-(wa*ifw)
if po<0:
    po=0
print(ca,wa,na,po)


# 0384, 2022-02-17 08:06:51, PP- (67%)

answer,cor,wrong = input().split(',')
ask = input()
sc =0
cornum =0
wronum =0
didnt=0
for i in range(len(ask)):
    if(ask[i]=='-'):didnt+=1
    elif(ask[i]==answer[i]):
        sc+=int(cor)
        cornum+= 1
    else:
        wronum+=1
        sc-=int(wrong)
print(cornum,wronum,didnt,sc)
# 0385, 2022-02-17 08:08:15, PP- (67%)

answer,cor,wrong = input().split(',')
ask = input()
sc =0
cornum =0
wronum =0
didnt=0
for i in range(len(ask)):
    if(ask[i]=='-'):didnt+=1
    elif(ask[i]==answer[i]):
        sc+=int(cor)
        cornum+= 1
    else:
        wronum+=1
        sc-=int(wrong)
didnt+= len(answer)-len(ask)
print(cornum,wronum,didnt,sc)
# 0386, 2022-02-17 08:09:00, PPP (100%)

answer,cor,wrong = input().split(',')
ask = input()
sc =0
cornum =0
wronum =0
didnt=0
for i in range(len(ask)):
    if(ask[i]=='-'):didnt+=1
    elif(ask[i]==answer[i]):
        sc+=int(cor)
        cornum+= 1
    else:
        wronum+=1
        sc-=int(wrong)
didnt+= len(answer)-len(ask)
print(cornum,wronum,didnt,max(sc,0))

# 0387, 2022-02-17 08:10:15, PPx (67%)

key, cor, wro = input().split(',')

ans = input()

cor = int(cor)

wro = int(wro)

i = 0
score = 0
no_cor = 0
no_wro = 0
no_bla = 0

while i < len(key):
  if ans[i] == '-':
    i += 1
    no_bla += 1
    continue
  elif ans[i] != key[i]:
    score -= wro
    no_wro += 1
  else:
      score += cor
      no_cor += 1
  i += 1

score = score if score >= 0 else 0

print(no_cor, no_wro, no_bla, score)
  
# 0388, 2022-02-17 08:12:14, PPx (67%)

key, cor, wro = input().replace(' ', '').split(',')

ans = input()

cor = int(cor)

wro = int(wro)

i = 0
score = 0
no_cor = 0
no_wro = 0
no_bla = 0

while i < len(key):
  if ans[i] == '-':
    i += 1
    no_bla += 1
    continue
  elif ans[i] != key[i]:
    score -= wro
    no_wro += 1
  elif ans[i] == key[i]:
      score += cor
      no_cor += 1
  i += 1

score = score if score >= 0 else 0

print(no_cor, no_wro, no_bla, score)
# 0389, 2022-02-17 08:14:27, PPP (100%)

key, cor, wro = input().replace(' ', '').split(',')

ans = input()

cor = int(cor)

wro = int(wro)

i = 0
score = 0
no_cor = 0
no_wro = 0
no_bla = 0

while i < len(key):
  try:
    ans[i]
  except:
    ans += '-'
  if ans[i] == '-':
    i += 1
    no_bla += 1
    continue
  elif ans[i] != key[i]:
    score -= wro
    no_wro += 1
  elif ans[i] == key[i]:
      score += cor
      no_cor += 1
  i += 1

score = score if score >= 0 else 0

print(no_cor, no_wro, no_bla, score)

# 0390, 2022-02-17 08:13:57, xxx (0%)

#grader quiz week 5
solution = input().strip().split(',')
student = input().strip()
add = int(solution[1])
subtract = int(solution[2])
score = 0
right = 0
wrong = 0
undo = 0

for index, answer in enumerate(student):
    if answer == solution[0][index]:
        score += add
        right += 1
    elif (answer in ['T','F']) and (answer != solotion[0][index]):
        score -= subtract
        wrong += 1
    elif answer == '-':
        undo += 1
    elif answer not in ['T', 'F']:
        undo += 1
        pass
if score < 0:
    score = 0
print(right, wrong, undo, score)
# 0391, 2022-02-17 08:14:38, PP- (67%)

#grader quiz week 5
solution = input().strip().split(',')
student = input().strip()
add = int(solution[1])
subtract = int(solution[2])
score = 0
right = 0
wrong = 0
undo = 0

for index, answer in enumerate(student):
    if answer == solution[0][index]:
        score += add
        right += 1
    elif (answer in ['T','F']) and (answer != solution[0][index]):
        score -= subtract
        wrong += 1
    elif answer == '-':
        undo += 1
    elif answer not in ['T', 'F']:
        undo += 1
        pass
if score < 0:
    score = 0
print(right, wrong, undo, score)
# 0392, 2022-02-17 08:16:02, PPP (100%)

#grader quiz week 5
solution = input().strip().split(',')
student = input().strip()
add = int(solution[1])
subtract = int(solution[2])
score = 0
right = 0
wrong = 0
undo = 0

undo = len(solution[0]) - len(student)
for index, answer in enumerate(student):
    if answer == solution[0][index]:
        score += add
        right += 1
    elif (answer in ['T','F']) and (answer != solution[0][index]):
        score -= subtract
        wrong += 1
    elif answer == '-':
        undo += 1
    elif answer not in ['T', 'F']:
        undo += 1
        pass
if score < 0:
    score = 0
print(right, wrong, undo, score)

# 0393, 2022-02-17 08:12:57, PPx (67%)

a,b,c = input().split(',')
a = str(a)
b = int(b)
c = int(c)
d = input()
e = 0 #จำนวนข้อถูก
f = 0 #จำนวนข้อผิด
g = 0
h = 0 #คะแนนรวม

for i in range(0,len(a)):
    if a[i] == d[i]:
        e += 1
    if d[i] == '-':
        g += 1
    elif a[i] != d[i]:
        f += 1
    i += 1
h = (e*b)-(c*f)
print(e,f,g,h)
# 0394, 2022-02-17 08:13:36, PP- (67%)

a,b,c = input().split(',')
a = str(a)
b = int(b)
c = int(c)
d = input()
e = 0 #จำนวนข้อถูก
f = 0 #จำนวนข้อผิด
g = 0
h = 0 #คะแนนรวม
if len(a) != len(d):
    d = d + '-'*(len(a)-len(d))
for i in range(0,len(a)):
    if a[i] == d[i]:
        e += 1
    if d[i] == '-':
        g += 1
    elif a[i] != d[i]:
        f += 1
    i += 1
h = (e*b)-(c*f)
print(e,f,g,h)

# 0395, 2022-02-17 08:14:30, PPP (100%)

a,b,c = input().split(',')
a = str(a)
b = int(b)
c = int(c)
d = input()
e = 0 #จำนวนข้อถูก
f = 0 #จำนวนข้อผิด
g = 0
h = 0 #คะแนนรวม
if len(a) != len(d):
    d = d + '-'*(len(a)-len(d))
for i in range(0,len(a)):
    if a[i] == d[i]:
        e += 1
    if d[i] == '-':
        g += 1
    elif a[i] != d[i]:
        f += 1
    i += 1
h = (e*b)-(c*f)
if h<0:
  print(e,f,g,'0')
else:
  print(e,f,g,h)

# 0396, 2022-02-17 08:10:30, PP- (67%)

a=input()
a,b,c=a.split(",")
d=str(input())
b=int(b)
c=int(c)
e=0
i=0
f=0
g=0
h=0
while len(d)!=len(a):
    d=d+"-"
while i<len(a):
    if d[i] in "TF":
        if a[i]==d[i]:
            e=e+b
            f=f+1
        else:
            e=e-c
            g=g+1
    else:
        h=h+1
    i=i+1
print(f,g,h,e)
# 0397, 2022-02-17 08:11:38, PPP (100%)

a=input()
a,b,c=a.split(",")
d=str(input())
b=int(b)
c=int(c)
e=0
i=0
f=0
g=0
h=0
while len(d)!=len(a):
    d=d+"-"
while i<len(a):
    if d[i] in "TF":
        if a[i]==d[i]:
            e=e+b
            f=f+1
        else:
            e=e-c
            g=g+1
    else:
        h=h+1
    i=i+1
if e<=0:
    e=0
print(f,g,h,e)

# 0398, 2022-02-17 08:06:44, PP- (67%)

ans = input().split(',')
res = input()
score = 0
t = 0
f = 0
not_done = 0
for i in range(len(res)):
    if res[i] == ans[0][i]:
        score += int(ans[1])
        t += 1
    elif res[i] == '-':
        score += 0
        not_done += 1
    else:
        score -= int(ans[2])
        f += 1
not_done += len(ans[0]) - len(res)
print(t,f,not_done,score)
# 0399, 2022-02-17 08:07:44, PPP (100%)

ans = input().split(',')
res = input()
score = 0
t = 0
f = 0
not_done = 0
for i in range(len(res)):
    if res[i] == ans[0][i]:
        score += int(ans[1])
        t += 1
    elif res[i] == '-':
        score += 0
        not_done += 1
    else:
        score -= int(ans[2])
        f += 1
not_done += len(ans[0]) - len(res)
if score < 0:
    score = 0
print(t,f,not_done,score)

# 0400, 2022-02-17 08:14:20, PPP (100%)

t = input().split(",")
#[TTTFF,"3","1"]
t[1] = int(t[1])
t[2] = int(t[2])
s = input()
s += "-"*((len(t[0]))-len(s))
right = 0
wrong = 0
un = 0
point = 0
for i in range(len(s)) :
    if  s[i] == t[0][i] :
        point += t[1]
        right += 1
    elif s[i] == "-" :
        point += 0
        un += 1
    else :
        point -= t[2]
        wrong += 1
if point < 0 :
    point = 0

print(right,wrong,un,point)
# 0401, 2022-02-17 08:14:54, PPP (100%)

t = input().split(",")
#[TTTFF,"3","1"]
t[1] = int(t[1])
t[2] = int(t[2])
s = input()
s += "-"*((len(t[0]))-len(s))
right = 0
wrong = 0
un = 0
point = 0
for i in range(len(s)) :
    if  s[i] == t[0][i] :
        point += t[1]
        right += 1
    elif s[i] == "-" :
        point += 0
        un += 1
    else :
        point -= t[2]
        wrong += 1
if point < 0 :
    point = 0

print(right,wrong,un,point)

# 0402, 2022-02-17 08:11:34, PP- (67%)

do=input().split(',')
ans=input()
sc=0
true=0
false=0
didnt=0
for i in range(len(ans)):
    if do[0][i]==ans[i]:
        sc+=int(do[1])
        true+=1
    elif ans[i]!=do[0][i] and ans[i]!='-':
        sc-=int(do[2])
        false+=1
    else:
        didnt+=1
if len(ans)!=do[0]:
    didnt+=len(do[0])-len(ans)
print(true,false,didnt,sc)

# 0403, 2022-02-17 08:12:42, PPP (100%)

do=input().split(',')
ans=input()
sc=0
true=0
false=0
didnt=0
for i in range(len(ans)):
    if do[0][i]==ans[i]:
        sc+=int(do[1])
        true+=1
    elif ans[i]!=do[0][i] and ans[i]!='-':
        sc-=int(do[2])
        false+=1
    else:
        didnt+=1
if len(ans)!=do[0]:
    didnt+=len(do[0])-len(ans)
if sc<0:
    sc=0
print(true,false,didnt,sc)


# 0404, 2022-02-17 08:14:21, --- (0%)

c=0
c1=0
c2=0
all=0
a=input().split(',')
print(a)
b=input()
for i in range(len(b)):
    if b[i]=='-':
        c+=1
    elif b[i]==a[0][i]:
        c1+=1
        all+=int(a[1])
    else:
        c2+=1
        all-=int(a[2])
c+=len(a[0])-len(b)
print(c1,c2,c,all)

# 0405, 2022-02-17 08:14:51, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif sol[i] != ans[i] and ans[i] != '-':
        wrong += 1
        score -= swrong
print(cor, wrong, len(ans)-cor-wrong, max(score, 0))

# 0406, 2022-02-17 08:11:06, --x (0%)

sol = input().split(',')
ans = input()
correct = 0
wrong = 0
notDone =  0
score = 0
for i in range(len(sol[0])):
    if (sol[0])[i] == 'T' and (sol[0])[i] == ans[i]:
        correct += 1
        score += int(sol[1])
    elif ans[i] == '-': 
        notDone += 1
    else:
        wrong += 1
        score -= int(sol[2])
print(correct,wrong,notDone,score)
# 0407, 2022-02-17 08:15:09, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0408, 2022-02-17 08:09:30, PP- (67%)

a=input().split(',')
b=input()
x = a[0]

score = 0
correct = 0
wrong = 0
n = len(x)-len(b)

for i in range(len(b)):
    if b[i] == x[i]:
        score += int(a[1])
        correct += 1
    elif b[i] == '-':
        score += 0
        n += 1
    else:
        score -= int(a[2])
        wrong += 1
print(correct,wrong,n,score)
# 0409, 2022-02-17 08:11:25, PPP (100%)

a=input().split(',')
b=input()
x = a[0]

score = 0
correct = 0
wrong = 0
n = len(x)-len(b)

for i in range(len(b)):
    if b[i] == x[i]:
        score += int(a[1])
        correct += 1
    elif b[i] == '-':
        score += 0
        n += 1
    else:
        score -= int(a[2])
        wrong += 1
if score<0:
    score = 0
else:
    pass
print(correct,wrong,n,score)

# 0410, 2022-02-17 08:15:04, xxx (0%)

re = input().split()
ans = input()
tf = str(re[0])
cor = 0
wro = 0
ze = 0
p = 0
for i in range(len(tf)):
    if tf[i] == ans[i]:
        cor += 1
    elif tf[i] == '-' :
        ze += 1
    else : wro += 1
p = cor*(int(re[1]))-wro*(int(re[2]))
print("{} {} {} {}".format(cor,wro,ze,p))
# 0411, 2022-02-17 08:15:27, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0412, 2022-02-17 08:14:53, xxx (0%)

answer,p,m=input().split(",")
n=input()
correct=0
wrong=0
n=0
score=0
for i  in range(len(answer)):
    if answer[i]==n[i]:
        score+=int(p)
        correct+=1
    elif str(n[i])=="-":
        n+=1
    else:
        score-=int(m)
        wrong+=1
print(str(correct)+" "+str(wrong)+" "+str(n)+" "+str(score))
# 0413, 2022-02-17 08:16:23, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0414, 2022-02-17 08:12:25, PPx (67%)

s, t, f = input().split(",")
a = input()
f1, f2, f3, f4 = 0, 0, 0, 0

for i in range(len(s)):
    if len(a) >= i:
        if a[i] == s[i]:
            f1 += 1
        elif a[i] == "-":
            f3 += 1
        else:
            f2 += 1
    else:
        f3 += 1
f4 = f1*int(t) - f2*int(f)
if f4 < 0:
    f4 = 0
print(f1, f2, f3, f4)
# 0415, 2022-02-17 08:16:17, PPP (100%)

s, t, f = input().split(",")
a = input()
f1, f2, f3, f4 = 0, 0, 0, 0

for i in range(len(s)):
    if len(a) > i:
        if a[i] == s[i]:
            f1 += 1
        elif a[i] == "-":
            f3 += 1
        else:
            f2 += 1
    else:
        f3 += 1
f4 = f1*int(t) - f2*int(f)
if f4 < 0:
    f4 = 0
print(f1, f2, f3, f4)


# 0416, 2022-02-17 08:13:01, P-P (67%)

t = input().split(',')
check = t[0] ; p = int(t[1]) ; f = int(t[2])
ans = input()
s = 0 ; T = 0 ; F = 0 ; E = 0
if len(check) > len(ans):
    ans += '-'*(len(check)-len(ans))
for i in range(len(check)):
    if ans[i] == check[i]:
        s += p
        T += 1
    elif ans[i] != check[i] and ans[i] != '-':
        s -= f
        F += 1
    elif ans[i] != check[i] and ans[i] == '-':
        s -= f
        E += 1
    if s <= 0:
        s = 0
print(T,F,E,s)
# 0417, 2022-02-17 08:16:04, PPP (100%)

t = input().split(',')
check = t[0] ; p = int(t[1]) ; f = int(t[2])
ans = input()
s = 0 ; T = 0 ; F = 0 ; E = 0
if len(check) > len(ans):
    ans += '-'*(len(check)-len(ans))
for i in range(len(check)):
    if ans[i] == check[i]:
        s += p
        T += 1
    elif ans[i] != check[i] and ans[i] != '-':
        s -= f
        F += 1
    elif ans[i] == '-':
        s -= 0
        E += 1
    if s <= 0:
        s = 0
print(T,F,E,s)

# 0418, 2022-02-17 08:12:58, --- (0%)

sol,scr1,scr2 = [e for e in input().split(',')]
ans = [str(f) for f in input()]
scr = 0
corr = 0
wrong = 0
noans = 0
while len(ans)< len(sol):
  ans += ['-']
for i in range(len(sol)):
  if ans[i]==sol[i]:
    scr += int(scr1)
    corr += 1
  elif ans[i]== 'F' :
    scr -= int(scr2)
    wrong += 1
  else :
    noans += 1
if scr < 0 :
  scr = 0
print(corr,wrong,noans,scr)
# 0419, 2022-02-17 08:15:33, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0420, 2022-02-17 08:14:21, PP- (67%)

ra,cp,wp = input().split(',')
ga = input()
ans = ['T','F']
p = 0
da = 0
a = 0
b = 0
da += len(ra)-len(ga)
for i in range(len(ga)) :
    if ga[i] == ra[i] :
        p += int(cp)
        a += 1
    else :
        if ga[i] != ra[i] and ga[i] in ans :
            p -= int(wp)
            b += 1
        else :
            da += 1
print(a,b,da,p)
# 0421, 2022-02-17 08:15:39, PPP (100%)

ra,cp,wp = input().split(',')
ga = input()
ans = ['T','F']
p = 0
da = 0
a = 0
b = 0
da += len(ra)-len(ga)
for i in range(len(ga)) :
    if ga[i] == ra[i] :
        p += int(cp)
        a += 1
    else :
        if ga[i] != ra[i] and ga[i] in ans :
            p -= int(wp)
            b += 1
        else :
            da += 1
if p < 0 :
    p = 0
print(a,b,da,p)

# 0422, 2022-02-17 08:14:30, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0423, 2022-02-17 08:14:56, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0424, 2022-02-17 08:12:43, PP- (67%)

a,b,c = input().split(",");b=int(b);c=int(c)
d = input()
e = len(a)
f = len(d)
x = e-f
d = d+("-"*x)
sc = 0
t = 0
f = 0
u = 0
for i in range(e):
    if d[i]==a[i]:
        sc += b
        t += 1
    elif d[i]=="-":
        sc = sc
        u +=1
    elif (d[i]!=a[i]) and (d[i]!="-"):
        sc -= c
        f += 1
print(str(t),str(f),str(u),str(sc))
# 0425, 2022-02-17 08:14:17, PPP (100%)

a,b,c = input().split(",");b=int(b);c=int(c)
d = input()
e = len(a)
f = len(d)
x = e-f
d = d+("-"*x)
sc = 0
t = 0
f = 0
u = 0
for i in range(e):
    if d[i]==a[i]:
        sc += b
        t += 1
    elif d[i]=="-":
        sc = sc
        u +=1
    elif (d[i]!=a[i]) and (d[i]!="-"):
        sc -= c
        f += 1
if sc < 0:
    sc = 0
print(str(t),str(f),str(u),str(sc))

# 0426, 2022-02-17 08:13:48, P-- (33%)

ans = input().split(',')
x = input()
cr = 0
none = 0
inc = 0
a = ans[0]
b = ans[1]
c = ans[2]
for i in range(len(x)):
  if a[i] == x[i]:
    cr += 1
  elif a[i] == '-':
    none += 1
  elif a[i] != x[i]:
    inc += 1
total = cr*int(b) - inc*int(c)
print(str(cr)+' '+str(inc)+' '+str(none)+' '+str(total))  
# 0427, 2022-02-17 08:14:46, PPP (100%)

t = input().split(",")
#[TTTFF,"3","1"]
t[1] = int(t[1])
t[2] = int(t[2])
s = input()
s += "-"*((len(t[0]))-len(s))
right = 0
wrong = 0
un = 0
point = 0
for i in range(len(s)) :
    if  s[i] == t[0][i] :
        point += t[1]
        right += 1
    elif s[i] == "-" :
        point += 0
        un += 1
    else :
        point -= t[2]
        wrong += 1
if point < 0 :
    point = 0

print(right,wrong,un,point)

# 0428, 2022-02-17 08:13:24, --- (0%)

Key = input().split(",")
StdData = input()
Plus, Min, Zero = 0, 0, 0
for i in range(len(Key)):
    if StdData[i] == "-": Zero += 1
    elif StdData[i] == Key[i]: Plus += 1
    else: Min += 1
print(Plus, Min, Zero, Plus*int(Key[1]) - Min*int(Key[2]))
# 0429, 2022-02-17 08:15:16, PPP (100%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = t*int(cr) - f*int(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)

# 0430, 2022-02-17 08:12:28, xxx (0%)

R_Answer = input().split(",")
answer = input()
if len(answer) < len(R_Answer[0]):
  answer += "-" * ((len(R_Answer[0])) - len(answer))
score = 0
correct = 0
wrong = 0
not_anwser = 0
for i in range(len(answer)):
  if answer[i] == R_Answer[i]:
    score += int(R_Answer[1])
    correct += 1
  elif answer[i] == "-":
    not_anwser += 1
  else:
    score -= int(R_Answer[2])
    wrong += 1

if score < 0:
  score = 0
print(correct, wrong, not_anwser, score)
# 0431, 2022-02-17 08:13:53, PPP (100%)

R_Answer = input().split(",")
answer = input()
if len(answer) < len(R_Answer[0]):
  answer += "-" * ((len(R_Answer[0])) - len(answer))
score = 0
correct = 0
wrong = 0
not_anwser = 0
for i in range(len(answer)):
  if answer[i] == R_Answer[0][i]:
    score += int(R_Answer[1])
    correct += 1
  elif answer[i] == "-":
    not_anwser += 1
  else:
    score -= int(R_Answer[2])
    wrong += 1

if score < 0:
  score = 0
print(correct, wrong, not_anwser, score)

# 0432, 2022-02-17 08:10:35, --- (0%)

ori, b, c = input().split(",")
b = int(b)
c = int(c)
tea = input()

ct, cf = 0, 0

for i in range(len(tea)):
  if tea[i] == '-':
    continue
  if tea[i] == ori[i]:
    ct += 1
  else:
    cf += 1

score = (ct * b) - (cf * c)
if score < 0:
  score = 0

print("{} {} {} {}", ct, cf, len(ori) - ct - cf, score)
# 0433, 2022-02-17 08:11:23, PPP (100%)

ori, b, c = input().split(",")
b = int(b)
c = int(c)
tea = input()

ct, cf = 0, 0

for i in range(len(tea)):
  if tea[i] == '-':
    continue
  if tea[i] == ori[i]:
    ct += 1
  else:
    cf += 1

score = ct * b - cf * c
if score < 0:
  score = 0

print("{} {} {} {}".format(ct, cf, len(ori) - ct - cf, score))


# 0434, 2022-02-17 08:14:43, compilation error (0%)

a,b,c=input().split(',')
d=input()
plus = 0
sumplus = 0
diff = 0
sumdiff = 0
none = len(a) - len(d)
for i in range(min(len(a),len(d))):
    if a[i] == d[i]:
        plus = plus + int(b)
        sumplus = sumplus + 1
    if a[i] != d[i] and d[i] != '-':
        diff = diff + int(c)
        sumdiff = sumdiff + 1
    if d[i] == '-':
        none = none + 1
e=plus-diff
if e < 0:
    e=0
print(sumplus,sumdiff,none,e))
# 0435, 2022-02-17 08:14:54, PPP (100%)

a,b,c=input().split(',')
d=input()
plus = 0
sumplus = 0
diff = 0
sumdiff = 0
none = len(a) - len(d)
for i in range(min(len(a),len(d))):
    if a[i] == d[i]:
        plus = plus + int(b)
        sumplus = sumplus + 1
    if a[i] != d[i] and d[i] != '-':
        diff = diff + int(c)
        sumdiff = sumdiff + 1
    if d[i] == '-':
        none = none + 1
e=plus-diff
if e < 0:
    e=0
print(sumplus,sumdiff,none,e)

# 0436, 2022-02-17 08:10:06, PP- (67%)

sol,p,wp=input().split(',')
p=int(p);wp=int(wp)
ap=0;tp=0;fp=0;np=0
ans=input()
for i in range(len(ans)):
    if ans[i]==sol[i]:
        ap+=p;tp+=1
    elif ans[i]=='-':
        ap+=0;np+=1
    else:
        ap-=wp;fp+=1
if ap<0:
    ap=0
else:pass
print(tp,fp,np,ap)


# 0437, 2022-02-17 08:17:29, PPP (100%)

sol,p,wp=input().split(',')
p=int(p);wp=int(wp)
ap=0;tp=0;fp=0;np=0
ans=input()
if len(ans)<len(sol):
    ans=ans+'-'*(len(sol)-len(ans))
for i in range(len(ans)):
    if ans[i]==sol[i]:
        ap+=p;tp+=1
    elif ans[i]=='-' :
        ap+=0;np+=1
    else:
        ap-=wp;fp+=1
if ap<0:
    ap=0
else:pass
print(tp,fp,np,ap)



# 0438, 2022-02-17 08:14:20, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0439, 2022-02-17 08:14:37, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0440, 2022-02-17 08:13:10, xxx (0%)

sol, scorrect, swrong = input().split(",")
ans = input()
scor, swrong = int(scorrect), int(swrong)
score = 0
correct, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scorrect
        correct += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(correct, wrong, didntdo, max(score, 0))
# 0441, 2022-02-17 08:13:35, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0442, 2022-02-17 08:13:06, P-x (33%)

x = input().split(",")
a = x[0]
aa = int(len(a))
b = x[1]
c = x[2]
y = input()

score = 0
cc = 0
co = 0
inc = 0
nop = 0

for i in range(aa):
    if a[i] == "-":
      nop +=1
    elif a[i] == y[i]:
        co +=1
        score += int(b)
    else:
        score -= int(c)
        inc += 1
  


print(co,inc,nop,score)
# 0443, 2022-02-17 08:16:19, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0444, 2022-02-17 08:13:26, P-- (33%)

test1,test2,test3 = input().split(",")
ans = str(input())
tes = list(test1)
ans = list(ans)
c = 0
w = len(ans)
for i in range(len(ans)):
  if ans[i]==tes[i]:
    c+=1
    w-=1
l = len(tes)-len(ans)
p = (int(test2)*c)-(int(test3)*w)
print(c,w,l,p)
# 0445, 2022-02-17 08:14:26, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif sol[i] != ans[i] and ans[i] != '-':
        wrong += 1
        score -= swrong
print(cor, wrong, len(ans)-cor-wrong, max(score, 0))

# 0446, 2022-02-17 08:10:39, xxx (0%)

x = input().split(",")
y = input()

t = 0
f = 0
b = 0
for i in x[1]:
    if x == "T":
        t+=1
    elif x == "F" :
        f += 1
    elif x == "-" :
        b +=0
print("t",'f'+'b'+(t+f+b))
# 0447, 2022-02-17 08:14:29, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0448, 2022-02-17 08:14:24, PPx (67%)

x = input().split(",")
ans = str(input())

c1 = 0
c2 = 0
c3 = 0

for i in range(len(x[0])):
  if ans[i]==(x[0])[i]:
    c1 += 1
  elif ans[i]=='-':
    c3 += 1
  elif ans[i]!=(x[0])[i]:
    c2 += 1

c = ( c1*int(x[1]) ) - ( c2*int(x[2]) )

print(c1,c2,c3,c)
# 0449, 2022-02-17 08:15:15, PPP (100%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = t*int(cr) - f*int(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)

# 0450, 2022-02-17 08:10:46, PP- (67%)

solution = input().split(",")
answer = input()

solution[1], solution[2] = int(solution[1]), int(solution[2])

right, wrong = 0, 0

for i in range(len(answer)):
    if answer[i] == '-':
        continue
    elif answer[i] == solution[0][i]:
        right += 1
    else:
        wrong += 1

print(right, wrong, int(len(solution[0]) - right - wrong), right*solution[1] - wrong * solution[2])
# 0451, 2022-02-17 08:12:12, PPP (100%)

solution = input().split(",")
answer = input()

solution[1], solution[2] = int(solution[1]), int(solution[2])

right, wrong = 0, 0

for i in range(len(answer)):
    if answer[i] == '-':
        continue
    elif answer[i] == solution[0][i]:
        right += 1
    else:
        wrong += 1

print(right, wrong, int(len(solution[0]) - right - wrong), max(0, right*solution[1] - wrong*solution[2]))

# 0452, 2022-02-17 08:14:51, PPx (67%)

ans = input().split(",")
student = input()
score = 0
t = 0
f = 0
n = 0
sans = ans[0]
scoret = int(ans[1])
scoref = int(ans[2])
for i in range (len(sans)) :
    if student[i] == sans[i] :
        score += scoret
        t+=1
    else:
        if student[i] == "-" :
            n+=1
        else :
            score -= scoref
            f+=1
print(t,f,n,score)
# 0453, 2022-02-17 08:15:48, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0454, 2022-02-17 08:14:16, PPP (100%)

an,t,f=input().split(',')
st=input()
t,f=int(t),int(f)
cor,wor=0,0
for i in range(len(st)):
  if st[i]==an[i]: cor+=1
  elif st[i]!=an[i] and st[i]!='-': wor+=1
score = (cor*t)-(wor*f)
if score <0: score=0
print(cor,wor,len(an)-cor-wor,score)
# 0455, 2022-02-17 08:14:38, PPP (100%)

an,t,f=input().split(',')
st=input()
t,f=int(t),int(f)
cor,wor=0,0
for i in range(len(st)):
  if st[i]==an[i]: 
    cor+=1
  elif st[i]!=an[i] and st[i]!='-': 
    wor+=1
score = (cor*t)-(wor*f)
if score <0: 
  score=0
print(cor,wor,len(an)-cor-wor,score)

# 0456, 2022-02-17 08:13:01, compilation error (0%)

key, score, minus = input().split(",")
ans = input()
a = len(key)
correct ,wrong ,non = 0,0,0
print(a)
for i in range (a)
    if ans[i] == '-':
        non+=1
    elif key[i] == minus[i]:
        correct+=1
    else:
        wrong+=1
print(correct,wrong,non,(int(score)*correct)-(int(correct)*wrong))
# 0457, 2022-02-17 08:14:52, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0458, 2022-02-17 08:11:30, PP- (67%)

key = input().split(',')
ans = input()
score = 0
right = 0
wrong = 0
count = 0

for i in range(len(ans)):
    if ans[i] == key[0][i] :
        score += int(key[1])
        right += 1
    elif ans[i] != '-' :
        score -= int(key[2])
        wrong += 1
    if ans[i] == 'T' or ans[i] == 'F':
        count += 1


print(right, wrong, len(key[0])-count, score)
# 0459, 2022-02-17 08:15:55, PPP (100%)

key = input().split(',')
ans = input()
score = 0
right = 0
wrong = 0
count = 0

for i in range(len(ans)):
    if ans[i] == key[0][i] :
        score += int(key[1])
        right += 1
    elif ans[i] != '-' :
        score -= int(key[2])
        wrong += 1
    if ans[i] == 'T' or ans[i] == 'F':
        count += 1

if score < 0:
    score = 0

print(right, wrong, len(key[0])-count, score)

# 0460, 2022-02-17 08:13:17, PP- (67%)

cor = input().split(',')
cor_sol = cor[0]
ans = input()
c = 0 #true
s = 0 #false
d = 0 #no do
for i in range(len(ans)):
    if ans[i] == cor_sol[i]:
        c +=1
    elif ans[i] == '-':
        d += 1 
    else:
        s-= 1
score = (int(cor[1])*c)+(int(cor[2])*s)
print(c,abs(s),d,score)


# 0461, 2022-02-17 08:15:56, PPP (100%)

cor = input().split(',')
cor_sol = cor[0]
ans = input()
c = 0 #true
s = 0 #false
d = 0 #no do
for i in range(len(ans)):
    if ans[i] == cor_sol[i]:
        c +=1
    elif ans[i] == '-':
        d += 1 
    else:
        s-= 1
score = (int(cor[1])*c)+(int(cor[2])*s)
d += len(cor_sol)-len(ans)
if score < 0:
    score = 0
print(c,abs(s),d,score)



# 0462, 2022-02-17 08:12:27, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0463, 2022-02-17 08:14:43, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0464, 2022-02-17 08:12:18, xxx (0%)

a = input().split(',')
b = input().split(',')
c = input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0465, 2022-02-17 08:14:44, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0466, 2022-02-17 08:16:43, --- (0%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x = x + int(b)
      y = y + 1
    elif d[i] == '-':
      p = p + 1
    else:
      x = x - int(c)
      z =x + 1
  else:
    p = p + 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0467, 2022-02-17 08:17:22, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0468, 2022-02-17 08:15:23, PPP (100%)

ans,p,m=input().split(",")
stu=input()
p=int(p)
m=int(m)
point=0
x=0
d=0
f=0

for i in range (len(stu)):
    if(ans[i]==stu[i]):
        point+=p
        x+=1
    elif(stu[i]=="-"):
        d+=1
    else:
        point-=m
        f+=1

if(i<len(ans)):
    d+=len(ans)-i-1

if(point>=0):
    print(x,f,d,point)
else:
    print(x,f,d,"0")

# 0469, 2022-02-17 08:15:48, PPP (100%)

ans,p,m=input().split(",")
stu=input()
p=int(p)
m=int(m)
point=0
x=0
c=0
f=0

for i in range (len(stu)):
    if(ans[i]==stu[i]):
        point+=p
        x+=1
    elif(stu[i]=="-"):
        c+=1
    else:
        point-=m
        f+=1

if(i<len(ans)):
    c+=len(ans)-i-1

if(point>=0):
    print(x,f,c,point)
else:
    print(x,f,c,"0")

# 0470, 2022-02-17 08:08:38, PP- (67%)

key,p,m=[i for i in input().split(',')]
ans=input()
p=int(p) ; m=int(m)
point=0
c=0
correct=0
wrong=0
for i in ans:
  if i=='T' or i=='F':
    c+=1
do=len(key)-c

if do!=0:
  ans+='-'*do

for j in range(len(key)):
  if key[j]==ans[j]:
    point+=p
    correct+=1
  elif ans[j]=='-':
    point+=0
  else:
    point-=m
    wrong+=1


print(correct,wrong,do,point)
# 0471, 2022-02-17 08:10:46, PPP (100%)

key,p,m=[i for i in input().split(',')]
ans=input()
p=int(p) ; m=int(m)
point=0
c=0
correct=0
wrong=0
for i in ans:
  if i=='T' or i=='F':
    c+=1
do=len(key)-c

if do!=0:
  ans+='-'*do

for j in range(len(key)):
  if key[j]==ans[j]:
    point+=p
    correct+=1
  elif ans[j]=='-':
    point+=0
  else:
    point-=m
    wrong+=1
if point<0:
  point=0


print(correct,wrong,do,point)

# 0472, 2022-02-17 08:14:49, P-x (33%)

x = input().split(",")
y = input()
answer = x[0]
multiplier = int(x[1])
eraser = int(x[2])
correct = 0
wrong = 0
didntdo = 0
score = 0
counter = 0
while len(y)<=len(answer):
    if counter == len(answer):
        break
    if y[counter] == answer[counter]:
        correct += 1
        counter += 1
    elif y[counter] != answer[counter]:
        wrong += 1
        counter += 1
    didntdo = len(answer)-(correct+wrong)
    score = (correct*multiplier)+(wrong*eraser)
print(correct,wrong,didntdo,score)
# 0473, 2022-02-17 08:15:16, PPP (100%)

sol, c, inc = input().split(",")
ans = input(); c = int(c); inc = int(inc)
score = tuk = pid = no = 0;
ans += "-" * (len(sol) - len(ans))
for i in range(len(ans)):
    if ans[i] == sol[i]:
        score += c; tuk += 1
    elif ans[i] != sol[i] and ans[i] != '-':
        score -= inc; pid += 1
    else: no += 1
print(tuk, pid, no, max(score, 0))

# 0474, 2022-02-17 08:13:31, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif sol[i] != ans[i] and ans[i] != '-':
        wrong += 1
        score -= swrong
print(cor, wrong, len(ans)-cor-wrong, max(score, 0))

# 0475, 2022-02-17 08:16:13, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0476, 2022-02-17 08:10:40, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0477, 2022-02-17 08:10:55, PPP (100%)

a = input()
s = input()

an = a.split(',')
ans = str(an[0])
t = int(an[1])
f = int(an[2])

p = 0
nt = 0
nf = 0
nd = 0
if len(s)!=len(ans):
    s+='-'*(len(ans)-len(s))
for i in range(len(ans)):
    if s[i]==ans[i]:
        p+=t
        nt+=1
    elif s[i]!=ans[i] and s[i]!='-':
        p-=f
        nf+=1
    elif s[i]=='-':
        nd+=1

if p<=0:
    p=0

print(nt,nf,nd,p)



# 0478, 2022-02-17 08:12:32, PPP (100%)

a = input().split(',')
b = input()
c = a[0]
point = 0
t = 0
f = 0
q = 0
b += '-'*(len(c)-len(b))
for i in range(len(c)):
    if b[i] == c[i]:
        point += int(a[1])
        t += 1
    elif b[i] == '-':
        q += 1
    else:
        point -= int(a[2])
        f +=1
if point < 0:
    point = 0
print(t,f,q,point)

# 0479, 2022-02-17 08:11:53, PPP (100%)

t,g,l = input().split(',')
s = input()
g = int(g)
l = int(l)
grade = 0
c =0
w=0
lose = 0
for i in range(len(s)):
    if s[i] =='-':
        lose+=1
    elif s[i] == t[i]:
        c+=1
    else:
        w+=1
lose += max(len(t) -len(s),0)

print(c,w,lose,max(0,c*g - w*l))

# 0480, 2022-02-17 08:16:22, PPP (100%)

a,b,c = input().split(',')
d = input()
x=0
y=0
z=0
p=0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0481, 2022-02-17 08:11:52, PPP (100%)

l1 = input().split(",")
s1 = input()
l2 = [0,0,0,0]
for i in range(len(s1)):
  if s1[i] == l1[0][i]:
    l2[0] += 1
    l2[3] += int(l1[1])
  elif s1[i] == "-":
    l2[2] += 1
  else:
    l2[1] += 1
    l2[3] -= int(l1[2])
l2[2] += len(l1[0])-len(s1)
l2[3] = max(0,l2[3])

l2 = [str(i) for i in l2]
print(" ".join(l2))

# 0482, 2022-02-17 08:14:29, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif sol[i] != ans[i] and ans[i] != '-':
        wrong += 1
        score -= swrong
print(cor, wrong, len(ans)-cor-wrong, max(score, 0))

# 0483, 2022-02-17 08:13:52, PPP (100%)

key = input().split(',')
p = int(key[1])
m = int(key[2])
key = key[0]
ans = input()
ans += ' '*(len(key) - len(ans))
cor = 0
wro = 0
no = 0
for i in range(len(key)) :
    if ans[i] not in ['T','F'] :
        no += 1
    elif ans[i] == key[i] :
        cor += 1
    elif ans[i] != key[i] :
        wro += 1
score = int((p*cor) - (m*wro))
if score < 0 :
    score = 0
print(cor,wro,no,score)

# 0484, 2022-02-17 08:15:10, PPP (100%)

ans,plus,minus = input().split(',')
st_ans = input()
notdo = 0
right = 0
wrong = 0
score = 0
for i in range(len(st_ans)):
    if str(st_ans[i]) == str(ans[i]):
        right += 1
        score += int(plus)
    elif str(st_ans[i]) == '-':
        notdo += 1
    elif str(st_ans[i]) != str(ans[i]):
        wrong += 1
        score -= int(minus)
if len(ans) != len(st_ans):
    notdo += len(ans) - len(st_ans)
else:
    pass
if score <= 0 :
    score = 0
print(right,wrong,notdo,score)


# 0485, 2022-02-17 08:12:04, PPP (100%)

sol, scor, swrong = input().split(",")
ans = input()
scor, swrong = int(scor), int(swrong)
score = 0
cor, wrong = 0, 0
didntdo = 0
ans += "-" * (len(sol) - len(ans))
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += scor
        cor += 1
    elif ans[i] == "-":
        didntdo += 1
    elif sol[i] != ans[i]:
        wrong += 1
        score -= swrong
print(cor, wrong, didntdo, max(score, 0))

# 0486, 2022-02-17 08:09:52, PPP (100%)

answer, score, minus = input().split(',')
score = int(score)
minus = int(minus)

student = input()

lst = ['-'] * len(answer)
for i in range(len(student)):
    lst[i] = student[i]

res = 0
do_count = 0
dont_count = 0
didnt_do = 0
for i in range(len(lst)):
    if lst[i] == '-':
        didnt_do +=1
    elif lst[i] == answer[i]:
        res += score
        do_count += 1
    else:
        res -= minus
        dont_count += 1
if res < 0:
    res = 0
print(do_count, dont_count, didnt_do, res)


# 0487, 2022-02-17 08:14:08, PPP (100%)

answer, score, minus = input().split(',')
score = int(score)
minus = int(minus)
a = input()
lst = ['-'] * len(answer)
for i in range(len(a)):
    lst[i] = a[i]
res = 0
do_count = 0
dont_count = 0
didnt_do = 0
for i in range(len(lst)):
    if lst[i] == '-':
        didnt_do +=1
    elif lst[i] == answer[i]:
        res += score
        do_count += 1
    else:
        res -= minus
        dont_count += 1
if res < 0:
    res = 0
print(do_count, dont_count, didnt_do, res)

# 0488, 2022-02-17 08:15:30, PPP (100%)

a = input().split(",")
result = a[0]
point = int(a[1])
mpoint = int(a[2])
do = input()
allpoint = 0
correct = 0
notdo = 0
incorrect = 0
for i in range(len(do)):
    if do[i] == result[i]:
        allpoint += point
        correct += 1
    else:
        if do[i] == '-':
            notdo += 1
        else:
            allpoint -= mpoint
            incorrect += 1
notdo += len(result) - len(do)
if allpoint < 0:
    allpoint = 0
print(correct, incorrect, notdo, allpoint)

# 0489, 2022-02-17 08:12:13, PPP (100%)

key, true, false = input().split(",")
student = str(input())
point = 0
count_true = 0
count_false = 0
count_none = 0
while len(student) < len(key):
    student += "-"

for i in range(len(key)):
    if student[i] == "-":
        point += 0
        count_none += 1
    elif student[i] == key[i]:
        point += int(true)
        count_true += 1
    else:
        point -= int(false)
        count_false += 1

if point < 0:
    point = 0

print(count_true, count_false, count_none, point)


# 0490, 2022-02-17 08:12:35, PPP (100%)

atf = input()
a, t, f = atf.split(',')
ans = input()
cor = 0
fls = 0
no = 0
for i in range(len(ans)):
    if a[i] == ans[i]:
        cor += 1
    elif ans[i] == '-':
        no += 1
    else :
        fls += 1
scr = cor*int(t) - fls*int(f)
no += len(a)-len(ans)
if scr < 0:
    scr = 0
print(cor, fls, no, scr)

# 0491, 2022-02-17 08:13:55, PPP (100%)

a=input().split(',')
b=input()
c=a[0];p=0;t=0;f=0;z=0
for i in range(len(c)):
    if b<c:
        b+=' '
    if b[i] == ' ':
        z+=1
    elif b[i] not in 'TF':
        z+=1
    elif b[i]==c[i]:
        p+=int(a[1])
        t+=1
    elif b[i]!=c[i]:
        p-=int(a[2])
        f+=1
if p < 0 :
    p=0
print(t,f,z,p)

# 0492, 2022-02-17 08:14:20, PPP (100%)

sol,a,b = input().split(',')
ans = input()
a = int(a)
b = int(b)
p = 0
t = 0
f = 0
c = 0
if len(ans)<len(sol) :
    ans += '-' *(len(sol) - len(ans))
for i in range(len(sol)) :
    if sol[i] == ans[i] :
        p += a
        t += 1
    elif ans[i] == '-' :
        c += 1
    else:
        p -= b
        f += 1
if p<0 :
    p = 0
    
print(t,f,c,p)

# 0493, 2022-02-17 08:10:44, PPP (100%)

ans,gain,deduct = input().split(',')
ans = [e for e in ans]
yourans = [e for e in input()]
unanswered = 0
true = 0
false = 0
score = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    score += int(gain)
    true += 1
  elif yourans[e] != '-':
    score -= int(deduct)
    false += 1
  else:
    unanswered += 1
if score < 0:
    score = 0
unanswered += len(ans) - len(yourans)
print(true,false,unanswered,score)

# 0494, 2022-02-17 08:10:35, PPP (100%)

key,correct,wrong = input().split(',')
answer = input()
score = 0
n = 0
n2 = 0
n3 = 0

for i in range(len(answer)):
    if answer[i] == '-':
        n3 += 1
        continue
    if answer[i] == key[i]:
        score += int(correct)
        n += 1
    elif answer[i] != key[i]:
        score -= int(wrong)
        n2 += 1
        
if len(key) > len(answer):
    n3 += len(key) - len(answer)

if score < 0 : score = 0
print(n, n2, n3, score)

# 0495, 2022-02-17 08:10:46, PPP (100%)

l1 = input().split(",")
s1 = input()
t = 0
f = 0
u = 0
p = 0
for i in range(len(s1)):
  if s1[i] == l1[0][i]:
    t += 1
    p += int(l1[1])
  elif s1[i] == "-":
    u += 1
  else:
    f += 1
    p -= int(l1[2])
u += len(l1[0])-len(s1)
p = max(0,p)

print(t,f,u,p)

# 0496, 2022-02-17 08:13:34, PPP (100%)

s=input().split(",")
a=input()
p=0 ; na=0 ; w=0
for i in range(len(a)):
  if (s[0])[i]==a[i]:
    p+=1
  elif a[i]=="-":
    na+=1
  else:
    w+=1
na+=(len(s[0])-len(a))
pp=int(s[1]) ; dp=int(s[2])
point=(p*pp)-(w*dp)
if point<0:
  point=0
print(p,w,na,point)

# 0497, 2022-02-17 08:13:34, PPP (100%)

a = input().split(",")
result = a[0]
point = int(a[1])
mpoint = int(a[2])
do = input()

allpoint = 0
correct = 0
notdo = 0
incorrect = 0
for i in range(len(do)):
    if do[i] == result[i]:
        allpoint += point
        correct += 1
    else:
        if do[i] == '-':
            notdo += 1
        else:
            allpoint -= mpoint
            incorrect += 1

notdo += len(result) - len(do)
if allpoint < 0:
    allpoint = 0
print(correct, incorrect, notdo, allpoint)

# 0498, 2022-02-17 08:07:28, PPP (100%)

p = input().split(",")
p[1] = int(p[1])
p[2] = int(p[2])
t = 0
t2 = 0
t3 = len(p[0])
sm = 0
ss = 0
s = input()
for i in range(len(s)):
	if s[i]=='-':
		ss+=1
	elif s[i]==p[0][i]:
		sm+=p[1]
		t3-=1
		t+=1
	else:
		sm-=p[2]
		t3-=1
		t2+=1
print(t,t2,t3,max(sm,0))


# 0499, 2022-02-17 08:13:44, PPP (100%)

ans,p,m=input().split(",")
stu=input()
p=int(p)
m=int(m)
point=0
t=0
d=0
f=0

for i in range (len(stu)):
    if(ans[i]==stu[i]):
        point+=p
        t+=1
    elif(stu[i]=="-"):
        d+=1
    else:
        point-=m
        f+=1

if(i<len(ans)):
    d+=len(ans)-i-1

if(point>=0):
    print(t,f,d,point)
else:
    print(t,f,d,"0")

# 0500, 2022-02-17 08:08:21, PPP (100%)

an,t,f=input().split(',')
st=input()
t,f=int(t),int(f)
cor,wor=0,0
for i in range(len(st)):
  if st[i]==an[i]: cor+=1
  elif st[i]!=an[i] and st[i]!='-': wor+=1
score = (cor*t)-(wor*f)
if score <0: score=0
print(cor,wor,len(an)-cor-wor,score)


# 0501, 2022-02-17 08:11:43, PPP (100%)

x1,x2,x3=input().split(',')
y=input()
x2=int(x2)
x3=int(x3)
s=0
c=0
m=0
n=0
for i in range(len(y)):
    if y[i] == x1[i] :
        c+=1
        s+=x2
    elif y[i] == '-' :
        m+=1
    else :
        n+=1
        s-=x3
if len(y) < len(x1):
    m+=len(x1)-len(y) 
print(c,n,m,max(s,0))


# 0502, 2022-02-17 08:10:03, PPP (100%)

# [64_2_PCG_05] 64_2_05_Loop

sol, gain, ded = input().split(',')
gain, ded = int(gain), int(ded)
check = input()

correct = 0
wrong = 0
blank = 0

if len(check) != len(sol):
  blank += len(sol) - len(check)

for i in range(len(check)):
  if check[i] == sol[i]:
    correct += 1
  elif check[i] == '-':
    blank += 1
  else:
    wrong += 1

score = (gain * correct) - (ded * wrong)

if score < 0:
  score = 0

print(correct, wrong, blank, score)

# 0503, 2022-02-17 08:10:48, PPP (100%)

a,b,c = input().split(',')
d = input()

while True :
    if len(a) != len(d) :
        d += '-'
    else:
        break

s1 = 0
s2 = 0
s3 = 0
s = 0
for i in range(len(a)) :
    if a[i] == d[i] :
        s += int(b)
        s1 += 1
    else:
        if d[i] != '-' :
            s -= int(c)
            s2 += 1
        else:
            s3 += 1
if s < 0 :
    s = 0

print(s1,s2,s3,s)

# 0504, 2022-02-17 08:15:36, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)


# 0505, 2022-02-17 08:10:46, PPP (100%)

sol, r, f = input().split(',')
ans = input()
count_r = 0
score = 0
count_f=0
blank=0
if len(ans)<len(sol):
    blank+=len(sol)-len(ans)
for i in range(len(ans)):
    if ans[i]==sol[i]:
        count_r+=1
        score+=int(r)
    elif ans[i]=='-':
        blank+=1
    else:
        count_f+=1
        score-=int(f)
if score<0:
    score=0
print(count_r,count_f,blank,score)

# 0506, 2022-02-17 08:15:43, PPP (100%)

a,t,f = input().split(",")
x = input()

c = 0
l = 0
z = 0

for k in range(len(x)) :
    if k == len(x) :
        break
    elif x[k] == "-" :
        z += 1
    elif x[k] == a[k] :
        c += 1
    else :
        l += 1

if (c*int(t) - l*int(f)) >= 0 :
    print(c,l,len(a) - len(x) + z,c*int(t) - l*int(f))
else :
    print(c,l,len(a) - len(x) + z,"0")
    

    
print()

# 0507, 2022-02-17 08:15:09, PPP (100%)

solutions, truepoints, falsepoints = input().split(',')
truepoints = int(truepoints)
falsepoints = int(falsepoints)
answers = input()

i = 0
score = 0
true = 0
false = 0

for answer in answers:
    if answer != '-':
        if answer == solutions[i]:
            score += truepoints
            true += 1
        else:
           score -= falsepoints
           false += 1
    i += 1
            
maidaitum = len(solutions) - true - false

if score < 0:
    score = 0

print(true, false, maidaitum, score)

# 0508, 2022-02-17 08:10:40, PPP (100%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = t*int(cr) - f*int(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)


# 0509, 2022-02-17 08:13:22, PPP (100%)

a = input().split(',')
b = str(input())
x=a[0]
t=0
n=0
n1=0
n2=0
for i in range(len(b)):
    #print(i)
    if x[i]==b[i]:
        t = t+int(a[1])
        n=n+1
    elif b[i]=='-':
        n2=n2+1
    else:
        if t!=0:
            t = t-int(a[2])
            n1=n1+1
        else:
            n1=n1+1

n2 = n2+len(x)-len(b)
print(n,n1,n2,t)

# 0510, 2022-02-17 08:15:51, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0511, 2022-02-17 08:13:30, PPP (100%)

an,t,f=input().split(',')
st=input()
t,f=int(t),int(f)
cor,wor=0,0
for i in range(len(st)):
  if st[i]==an[i]: cor+=1
  elif st[i]!=an[i] and st[i]!='-': wor+=1
score = (cor*t)-(wor*f)
if score <0: score=0
print(cor,wor,len(an)-cor-wor,score)

# 0512, 2022-02-17 08:11:21, PPP (100%)

solution = input().split(",")
answer = input()

solution[1], solution[2] = int(solution[1]), int(solution[2])

right, wrong, = 0, 0

for i in range(len(answer)):
    if answer[i] == '-':
        continue
    elif answer[i] == solution[0][i]:
        right += 1
    else:
        wrong += 1

print(right, wrong, int(len(solution[0]) - right - wrong), max(0, right*solution[1] - wrong*solution[2]))

# 0513, 2022-02-17 08:15:01, PPP (100%)

a,b,c = input().split(',')
d = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == d[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)

# 0514, 2022-02-17 08:12:15, PPP (100%)

an,t,f=input().split(',')
st=input()
t,f=int(t),int(f)
correct = 0
worng = 0
for i in range(len(st)):
    if st[i]==an[i]: correct+=1
    elif st[i]!=an[i] and st[i]!='-': 
        worng+=1
score = (correct*t)-(worng*f)
if score <0: score=0
print(correct,worng,len(an)-correct-worng,score)

# 0515, 2022-02-17 08:11:26, PPP (100%)

key,t,f = [e for e in input().split(",")]
ans = input()
ans = ans + (" "*(len(key)-len(ans)))
tuk = 0
pid = 0
mai = 0
for i in range(len(key)) :
    if ans[i] == key[i] :
        tuk += 1
    elif ans[i] == "-" or ans[i] == " " :
        mai += 1
    else :
        pid += 1
        
summ = 0 + tuk*(int(t)) - pid*(int(f))
if summ < 0 :
    summ = 0
    
print(tuk,pid,mai,summ)
        


# 0516, 2022-02-17 08:15:26, PPP (100%)

sol, c, inc = input().split(",")
ans = input(); c = int(c); inc = int(inc)
score = tuk = pid = no = 0;
ans += "-" * (len(sol) - len(ans))
for i in range(len(ans)):
    if ans[i] == sol[i]:
        score += c; tuk += 1
    elif ans[i] != sol[i] and ans[i] != '-':
        score -= inc; pid += 1
    else: no += 1
print(tuk, pid, no, max(score, 0))

Max Score = 67


# 0517, 2022-02-17 08:06:11, compilation error (0%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
while len(k)!=count:
    if k[count]=b[count]:
        true+=a[1]
    elif k[count]!=b[count]:
        faus-=a[2]
    else: none+=1
    count+=1
print(true,faus,none,true-faus)
# 0518, 2022-02-17 08:06:27, xxx (0%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
while len(k)!=count:
    if k[count]==b[count]:
        true+=a[1]
    elif k[count]!=b[count]:
        faus-=a[2]
    else: none+=1
    count+=1
print(true,faus,none,true-faus)
# 0519, 2022-02-17 08:07:05, --x (0%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
while len(k)!=count:
    if k[count]==b[count]:
        true+=int(a[1])
    elif k[count]!=b[count]:
        faus-=int(a[2])
    else: none+=1
    count+=1
print(true,faus,none,true-faus)
# 0520, 2022-02-17 08:08:27, --x (0%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
while len(k)!=count:
    if k[count]==b[count]:
        true+=1
    elif k[count]!=b[count]:
        faus-=1
    else: none+=1
    count+=1
print(true,faus,none,true*int(a[1])-faus*int(a[2]))
# 0521, 2022-02-17 08:13:18, PPx (67%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
while len(k)!=count:
    if k[count]==b[count]:
        true+=1
    elif (k[count]=="T" and b[count]=="F") or (k[count]=="F" and b[count]=="T"):
        faus+=1
    else: none+=1
    count+=1
point=true*int(a[1])-faus*int(a[2])
if point<0:
    point=0
print(true,faus,none,point)
# 0522, 2022-02-17 08:14:16, PPx (67%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
if len(k)>len(b):
    k=len(b)
while len(k)!=count:
    if k[count]==b[count]:
        true+=1
    elif (k[count]=="T" and b[count]=="F") or (k[count]=="F" and b[count]=="T"):
        faus+=1
    else: none+=1
    count+=1
point=true*int(a[1])-faus*int(a[2])
if point<0:
    point=0
print(true,faus,none,point)
# 0523, 2022-02-17 08:14:45, PP- (67%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
if len(k)>len(b):
    k=b
while len(k)!=count:
    if k[count]==b[count]:
        true+=1
    elif (k[count]=="T" and b[count]=="F") or (k[count]=="F" and b[count]=="T"):
        faus+=1
    else: none+=1
    count+=1
point=true*int(a[1])-faus*int(a[2])
if point<0:
    point=0
print(true,faus,none,point)
# 0524, 2022-02-17 08:16:57, compilation error (0%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
if len(k)>len(b):
    k=b
    while len(k)!=count:
    if k[count]==b[count]:
        true+=1
    elif (k[count]=="T" and b[count]=="F") or (k[count]=="F" and b[count]=="T"):
        faus+=1
    else: none+=1
    count+=1
while len(k)!=count:
    if k[count]==b[count]:
        true+=1
    elif (k[count]=="T" and b[count]=="F") or (k[count]=="F" and b[count]=="T"):
        faus+=1
    else: none+=1
    count+=1
point=true*int(a[1])-faus*int(a[2])
if point<0:
    point=0
print(true,faus,none,point)
# 0525, 2022-02-17 08:17:24, PP- (67%)

a=input().split(",")
b=input()
count=0
k=a[0]
true=0
faus=0
none=0
if len(k)>len(b):
    k=b
    while len(k)!=count:
        if k[count]==b[count]:
            true+=1
        elif (k[count]=="T" and b[count]=="F") or (k[count]=="F" and b[count]=="T"):
            faus+=1
        else: none+=1
        count+=1
while len(k)!=count:
    if k[count]==b[count]:
        true+=1
    elif (k[count]=="T" and b[count]=="F") or (k[count]=="F" and b[count]=="T"):
        faus+=1
    else: none+=1
    count+=1
point=true*int(a[1])-faus*int(a[2])
if point<0:
    point=0
print(true,faus,none,point)

# 0526, 2022-02-17 08:07:20, P-x (33%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(x)):
    if x[i]==b[i]:
        c+=1
    if x[i]!=b[i]:
        d+=1
    if x[i]=='-':
        e+=1
    if x[i]==' ':
        e+=1
q=(c*int(a[1]))-((d+e)*int(a[2]))
print(c,d,e,q)
        
    

# 0527, 2022-02-17 08:08:47, P-x (33%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(x)):
    if x[i]==b[i]:
        c+=1
    elif x[i]!=b[i]:
        d+=1
    elif x[i]=='-':
        e+=1
    elif x[i]==' ':
        e+=1
q=(c*int(a[1]))-((d+e)*int(a[2]))
print(c,d,e,q)
        
    

# 0528, 2022-02-17 08:12:00, P-x (33%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(x)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1
q=(c*int(a[1]))-((d+e)*int(a[2]))
print(c,d,e,q)
        
    

# 0529, 2022-02-17 08:12:44, PPx (67%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(x)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1
q=(c*int(a[1]))-((d)*int(a[2]))
print(c,d,e,q)
        
    

# 0530, 2022-02-17 08:13:54, PP- (67%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1
q=(c*int(a[1]))-((d)*int(a[2]))
print(c,d,e,q)
        
    

# 0531, 2022-02-17 08:15:30, P-- (33%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1
        
e=len(x)-len(b)
q=(c*int(a[1]))-((d)*int(a[2]))
print(c,d,e,q)
        
    

# 0532, 2022-02-17 08:16:30, PP- (67%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1
        
e+=len(x)-len(b)
q=(c*int(a[1]))-((d)*int(a[2]))
print(c,d,e,q)
# 0533, 2022-02-17 08:17:28, P-- (33%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1
        
e+=len(x)-len(b)
q=(c*int(a[1]))-((d+e)*int(a[2]))
print(c,d,e,q)

    


# 0534, 2022-02-17 08:07:19, xxx (0%)

x = input()
a = str(input())
test, plus, minus = x.split(',')
score = 0
correct = 0
incorrect = 0
none = 0
for i in range(len(test)):
    if test[i] == a[i]:
        score += plus
        correct += 1
    if test[i] != a[i]:
        if test[i] == 'F':
            incorrect += 1
            score -= minus
        if test[i] == '-':
            none += 1
print(correct, incorrect, none, score)

         
# 0535, 2022-02-17 08:08:20, --x (0%)

x = input()
a = str(input())
test, plus, minus = x.split(',')
plus = int(plus)
minus = int(minus)
score = 0
correct = 0
incorrect = 0
none = 0
for i in range(len(test)):
    if test[i] == a[i]:
        score += plus
        correct += 1
    if test[i] != a[i]:
        if test[i] == 'F':
            incorrect += 1
            score -= minus
        if test[i] == '-':
            none += 1
print(correct, incorrect, none, score)

         
         
# 0536, 2022-02-17 08:09:50, --- (0%)

x = input()
test = str(input())
a, plus, minus = x.split(',')
plus = int(plus)
minus = int(minus)
score = 0
correct = 0
incorrect = 0
none = 0
for i in range(len(test)):
    if test[i] == a[i]:
        score += plus
        correct += 1
    if test[i] != a[i]:
        if test[i] == 'F':
            incorrect += 1
            score -= minus
        if test[i] == '-':
            none += 1
print(correct, incorrect, none, score)

         
# 0537, 2022-02-17 08:11:06, --- (0%)

x = input()
test = str(input())
a, plus, minus = x.split(',')
plus = int(plus)
minus = int(minus)
score = 0
correct = 0
incorrect = 0
none = 0
for i in range(len(a)-1):
    if test[i] == a[i]:
        score += plus
        correct += 1
    if test[i] != a[i]:
        if test[i] == 'F':
            incorrect += 1
            score -= minus
        if test[i] == '-':
            none += 1
print(correct, incorrect, none, score)

         
# 0538, 2022-02-17 08:11:39, --x (0%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if ans[i] == check[i] :
    score += cor
    c += 1
  elif ans[i] != check[i] :
    if check[i] == '-':
      d += 1
    else:
      w += 0
print(c, w, d, score)
# 0539, 2022-02-17 08:12:58, --x (0%)

x = input()
test = str(input())
a, plus, minus = x.split(',')
plus = int(plus)
minus = int(minus)
score = 0
correct = 0
incorrect = 0
none = 0
for i in range(len(a)):
    if test[i] == a[i]:
        score += plus
        correct += 1
    if test[i] != a[i]:
        if test[i] == 'F':
            incorrect += 1
            score -= minus
        if test[i] == '-':
            none += 1
print(correct, incorrect, none, score)

         
# 0540, 2022-02-17 08:13:33, PP- (67%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if len(ans) != len(check) : 
    d += len(ans) - len(check)
  if len(ans) == len(check):
    if ans[i] == check[i] :
      score += cor
      c += 1
    elif ans[i] != check[i] :
      if check[i] == '-':
        d += 1
      else:
        w += 1
        score -= wro
print(c, w, d, score)

# 0541, 2022-02-17 08:13:12, xxx (0%)


q = input().split(",")
ans = input()
q1 = q[0]
q2 = int(q[1])
q3 = q[2]

T = 0
F = 0
plus = 0
score = 0
non = 0


for i in range(len(ans)):
    if ans[i] == q1[i]:
        score += q2
        T += 1
    elif ans[i] == "-":
        non += 1
    else:
        score -= q3
        F += 1
        
non += len(q1) - len(ans)

if score <= 0:
    score == 0

a = []
a.append(T)
a.append(F)
a.append(non)
a.append(score)

print(a, end = " ")

# 0542, 2022-02-17 08:14:01, --- (0%)


q = input().split(",")
ans = input()
q1 = q[0]
q2 = int(q[1])
q3 = int(q[2])

T = 0
F = 0
plus = 0
score = 0
non = 0


for i in range(len(ans)):
    if ans[i] == q1[i]:
        score += q2
        T += 1
    elif ans[i] == "-":
        non += 1
    else:
        score -= q3
        F += 1
        
non += len(q1) - len(ans)

if score <= 0:
    score == 0

a = []
a.append(T)
a.append(F)
a.append(non)
a.append(score)

print(a, end = " ")

# 0543, 2022-02-17 08:15:02, --- (0%)

q = input().split(",")
ans = input()
q1 = q[0]
q2 = int(q[1])
q3 = int(q[2])

T = 0
F = 0
plus = 0
score = 0
non = 0


for i in range(len(ans)):
    if ans[i] == q1[i]:
        score += q2
        T += 1
    elif ans[i] == "-":
        non += 1
    else:
        score -= q3
        F += 1
        
non += len(q1) - len(ans)

if score < 0:
    score == 0

a = []
a.append(T)
a.append(F)
a.append(non)
a.append(score)

print(a, end = " ")
# 0544, 2022-02-17 08:15:25, --- (0%)

q = input().split(",")
ans = input()
q1 = q[0]
q2 = int(q[1])
q3 = int(q[2])

T = 0
F = 0
plus = 0
score = 0
non = 0


for i in range(len(ans)):
    if ans[i] == q1[i]:
        score += q2
        T += 1
    elif ans[i] == "-":
        non += 1
    else:
        score -= q3
        F += 1
        
non += len(q1) - len(ans)

if score < 0:
    score = 0

a = []
a.append(T)
a.append(F)
a.append(non)
a.append(score)

print(a, end = " ")
# 0545, 2022-02-17 08:16:32, xxx (0%)


q = input().split(",")
ans = input()
q1 = q[0]
q2 = int(q[1])
q3 = int(q[2])

T = 0
F = 0
plus = 0
score = 0
non = 0


for i in range(len(ans)):
    if ans[i] == q1[i]:
        score += q2
        T += 1
    elif ans[i] == "-":
        non += 1
    else:
        score -= q3
        F += 1
        
non += len(q1) - len(ans)

if score < 0:
    score == 0

a = []
a.append(T)
a.append(F)
a.append(non)
a.append(score)

print(T + " " + F + " " + non + " " + score)

# 0546, 2022-02-17 08:17:17, PP- (67%)


q = input().split(",")
ans = input()
q1 = q[0]
q2 = int(q[1])
q3 = int(q[2])

T = 0
F = 0
plus = 0
score = 0
non = 0


for i in range(len(ans)):
    if ans[i] == q1[i]:
        score += q2
        T += 1
    elif ans[i] == "-":
        non += 1
    else:
        score -= q3
        F += 1
        
non += len(q1) - len(ans)

if score < 0:
    score == 0

a = []
a.append(T)
a.append(F)
a.append(non)
a.append(score)

print(str(T) + " " + str(F) + " " + str(non) + " " + str(score))


# 0547, 2022-02-17 08:10:23, compilation error (0%)

a=input().split(',')
right=a[1]
ans=input()
correct=0
wrong=0
no=0
point=0
for i in range(len(ans)):
    if str(ans[i])==str(right[i]):
        point+=int(a[1])
        correct+=1
    if str(ans[i])== "-"
        no+=1
    else:
        point-=int(a[2])
        wrong+=1
print(correct,wrong,no,point)
# 0548, 2022-02-17 08:11:55, xxx (0%)

a=input().split(',')
right=a[1]
ans=input()
correct=0
wrong=0
no=0
point=0
for i in range(len(ans)):
    if str(ans[i])==str(right[i]):
        point+=int(a[1])
        correct+=1
    else:
        if str(ans[i]) == "-":
            no+=1
        else:
            point-=int(a[2])
            wrong+=1
print(correct,wrong,no,point)

# 0549, 2022-02-17 08:12:32, xxx (0%)

a=input().split(',')
right=a[1]
ans=input()
correct=0
wrong=0
no=0
point=0
for i in range(len(ans)):
    if str(ans[i])==str(right[i]):
        point+=int(a[1])
        correct+=1
    elif str(ans[i]) == "-":
            no+=1
    else:
        point-=int(a[2])
        wrong+=1
print(correct,wrong,no,point)
# 0550, 2022-02-17 08:13:38, xxx (0%)

a=input().split(',')
right=a[1][:]
ans=input()
correct=0
wrong=0
no=0
point=0
for i in range(len(ans)):
    if str(ans[i])==str(right[i]):
        point+=int(a[1])
        correct+=1
    elif str(ans[i]) == "-":
            no+=1
    else:
        point-=int(a[2])
        wrong+=1
print(correct,wrong,no,point)
# 0551, 2022-02-17 08:13:43, xxx (0%)

a=input().split(',')
right=a[1][:]
ans=input()
correct=0
wrong=0
no=0
point=0
for i in range(len(ans)):
    if str(ans[i])==str(right[i]):
        point+=int(a[1])
        correct+=1
    elif str(ans[i]) == "-":
            no+=1
    else:
        point-=int(a[2])
        wrong+=1
print(correct,wrong,no,point)
# 0552, 2022-02-17 08:15:59, PP- (67%)

a=input().split(',')
right=a[0][:]
ans=input()
correct=0
wrong=0
no=0
point=0
for i in range(len(ans)):
    if str(ans[i])==str(right[i]):
        point+=int(a[1])
        correct+=1
    elif str(ans[i]) == "-":
            no+=1
    else:
        point-=int(a[2])
        wrong+=1
print(correct,wrong,no,point)

# 0553, 2022-02-17 08:13:12, PPx (67%)

listt , pt , pf = input().split(',')
listf = input()
pt = int(pt)
pf = int(pf)
ct = 0
cf = 0
ch = 0
p = 0
for i in range(len(listt)):
    if listf[i] == listt[i] and listf[i] in ['T','F'] :
        ct += 1
        p += pt
    if listf[i] != listt[i] and listf[i] in ['T','F'] :
        cf += 1
        p -= pf
    if listf[i] == '-' :
        ch += 1
if p < 0 :
    p = 0
print(ct, cf , ch , p )
# 0554, 2022-02-17 08:13:42, PPx (67%)

listt , pt , pf = input().split(',')
listf = input()
pt = int(pt)
pf = int(pf)
ct = 0
cf = 0
ch = 0
p = 0
for i in range(len(listt)):
    if listf[i] == listt[i] and listf[i] in ['T','F'] :
        ct += 1
        p += pt
    if listf[i] != listt[i] and listf[i] in ['T','F'] :
        cf += 1
        p -= pf
    if listf[i] == '-' :
        ch += 1
if p < 0 :
    p = 0
print(ct, cf , ch , p)
# 0555, 2022-02-17 08:14:55, P-x (33%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif b[i] != a[i] :
        t += 1
        i += 1
    elif b[i] == "-" or b[i] == " " :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0556, 2022-02-17 08:15:09, --- (0%)

listt , pt , pf = input().split(',')
listf = input()
pt = int(pt)
pf = int(pf)
ct = 0
cf = 0
ch = 0
p = 0
for i in range(len(listt)):
    if i < len(listf):
        break
    if listf[i] == listt[i] and listf[i] in ['T','F'] :
        ct += 1
        p += pt
    if listf[i] != listt[i] and listf[i] in ['T','F'] :
        cf += 1
        p -= pf
    if listf[i] == '-' :
        ch += 1
if p < 0 :
    p = 0
print(ct, cf , ch , p )
# 0557, 2022-02-17 08:16:18, PP- (67%)

listt , pt , pf = input().split(',')
listf = input()
pt = int(pt)
pf = int(pf)
ct = 0
cf = 0
ch = 0
p = 0
for i in range(len(listt)):
    if i >= len(listf):
        break
    if listf[i] == listt[i] and listf[i] in ['T','F'] :
        ct += 1
        p += pt
    if listf[i] != listt[i] and listf[i] in ['T','F'] :
        cf += 1
        p -= pf
    if listf[i] == '-' :
        ch += 1
if p < 0 :
    p = 0
print(ct, cf , ch , p )
# 0558, 2022-02-17 08:16:29, PP- (67%)

listt , pt , pf = input().split(',')
listf = input()
pt = int(pt)
pf = int(pf)
ct = 0
cf = 0
ch = 0
p = 0
for i in range(len(listt)):
    if i >= len(listf):
        break
    if listf[i] == listt[i] and listf[i] in ['T','F'] :
        ct += 1
        p += pt
    if listf[i] != listt[i] and listf[i] in ['T','F'] :
        cf += 1
        p -= pf
    if listf[i] == '-' :
        ch += 1
if p < 0 :
    p = 0
print(ct, cf , ch , p )

# 0559, 2022-02-17 08:11:52, xxx (0%)

sol = input().split(',')
ans = input()
c = 0
r = 0
w = 0
no = 0
sol = solution[0]
for i in range(0,len(ans)):
    if ans[i]==sol[i]:
        c += int(solution[1])
        r += 1
    else:
        if ans[i]=='-':
            c += 0
            no += 1
        else:
            c -= int(solution[2])
            w += 1
no = no + (len(sol) - len(ans))
print(r, w, no, c)
# 0560, 2022-02-17 08:12:39, PP- (67%)

solution = input().split(',')
ans = input()
c = 0
r = 0
w = 0
no = 0
sol = solution[0]
for i in range(0,len(ans)):
    if ans[i]==sol[i]:
        c += int(solution[1])
        r += 1
    else:
        if ans[i]=='-':
            c += 0
            no += 1
        else:
            c -= int(solution[2])
            w += 1
no = no + (len(sol) - len(ans))
print(r, w, no, c)
# 0561, 2022-02-17 08:14:00, PP- (67%)

solution = input().split(',')
ans = input()
c = 0
r = 0
w = 0
no = 0
sol = solution[0]

for i in range(0,len(ans)):
    if ans[i]==sol[i]:
        c += int(solution[1])
        r += 1
    else:
        if ans[i]=='-':
            c += 0
            no += 1
        else:
            c -= int(solution[2])
            w += 1
no = no + (len(sol) - len(ans))
print(r, w, no, c)
# 0562, 2022-02-17 08:16:13, compilation error (0%)

solution = input().split(',')
ans = input()
c = 0
r = 0
w = 0
no = 0
sol = solution[0]

for i in range(0,len(ans)):
    if ans[i]==sol[i]:
        c += int(solution[1])
        r += 1
    else:
        if ans[i]=='-':
            c += 0
            no += 1
        if ans[i]!=ans[i+1]
            c -= int(solution[2])
            w += 1
no = no + (len(sol) - len(ans))
print(r, w, no, c)
# 0563, 2022-02-17 08:16:23, P-x (33%)

solution = input().split(',')
ans = input()
c = 0
r = 0
w = 0
no = 0
sol = solution[0]

for i in range(0,len(ans)):
    if ans[i]==sol[i]:
        c += int(solution[1])
        r += 1
    else:
        if ans[i]=='-':
            c += 0
            no += 1
        if ans[i]!=ans[i+1]:
            c -= int(solution[2])
            w += 1
no = no + (len(sol) - len(ans))
print(r, w, no, c)
# 0564, 2022-02-17 08:16:34, PP- (67%)

solution = input().split(',')
ans = input()
c = 0
r = 0
w = 0
no = 0
sol = solution[0]

for i in range(0,len(ans)):
    if ans[i]==sol[i]:
        c += int(solution[1])
        r += 1
    else:
        if ans[i]=='-':
            c += 0
            no += 1
        else:
            c -= int(solution[2])
            w += 1
no = no + (len(sol) - len(ans))
print(r, w, no, c)

# 0565, 2022-02-17 08:10:31, xxx (0%)

solution,point_per_unit,worng = input().split(",")
point_per_unit = int(point_per_unit)
wrong = int(worng)
ans = input()
answer_list = []
for i in range(len(ans)):
    if ans[i] == solution[i]:
        answer_list.append('T')
    elif ans[i] == '-':
        answer_list.append('-')
    else:
        answer_list.append('F')
point = point_per_unit*len(solution)
true_ans = 0
false_ans = 0
not_do_ans = 0
for i in answer_list:
    if i == 'F':
        false_ans += 1
        point -= worng
    elif i == 'T':
        true_ans += 1
    elif i == '-':
        not_do_ans += 1
if point < 0:
    point = 0
print(true_ans,false_ans,not_do_ans,point)
# 0566, 2022-02-17 08:12:35, xxx (0%)

solution,point_per_unit,worng = input().split(",")
point_per_unit = int(point_per_unit)
wrong = int(worng)
ans = input()
answer_list = []
for i in range(len(ans)):
    if ans[i] == solution[i]:
        answer_list += ['T']
    elif ans[i] == '-':
        answer_list += ['-']
    else:
        answer_list += ['F']
        
point = point_per_unit*len(solution)
true_ans = 0
false_ans = 0
not_do_ans = 0
for i in answer_list:
    if i == 'F':
        false_ans += 1
        point -= worng
    elif i == 'T':
        true_ans += 1
    elif i == '-':
        not_do_ans += 1
if point < 0:
    point = 0
    
print(true_ans,false_ans,not_do_ans,point)
# 0567, 2022-02-17 08:14:27, --- (0%)

solution,point_per_unit,wrong = input().split(",")
point_per_unit = int(point_per_unit)
wrong = int(wrong)
ans = input()
answer_list = []
for i in range(len(ans)):
    if ans[i] == solution[i]:
        answer_list.append('T')
    elif ans[i] == '-':
        answer_list.append('-')
    else:
        answer_list.append('F')
point = point_per_unit*len(solution)
true_ans = 0
false_ans = 0
not_do_ans = 0
for i in answer_list:
    if i == 'F':
        false_ans += 1
        point -= wrong
    elif i == 'T':
        true_ans += 1
    elif i == '-':
        not_do_ans += 1
if point < 0:
    point = 0
print(true_ans,false_ans,not_do_ans,point)
# 0568, 2022-02-17 08:15:23, PP- (67%)

solution,point_per_unit,wrong = input().split(",")
point_per_unit = int(point_per_unit)
wrong = int(wrong)
ans = input()
answer_list = []
for i in range(len(ans)):
    if ans[i] == solution[i]:
        answer_list.append('T')
    elif ans[i] == '-':
        answer_list.append('-')
    else:
        answer_list.append('F')
true_ans = 0
false_ans = 0
not_do_ans = 0
point = 0
for i in answer_list:
    if i == 'F':
        false_ans += 1
        point -= wrong
    elif i == 'T':
        true_ans += 1
        point += point_per_unit
    elif i == '-':
        not_do_ans += 1
if point < 0:
    point = 0
print(true_ans,false_ans,not_do_ans,point)
# 0569, 2022-02-17 08:15:32, PP- (67%)

solution,point_per_unit,wrong = input().split(",")
point_per_unit = int(point_per_unit)
wrong = int(wrong)
ans = input()
answer_list = []
for i in range(len(ans)):
    if ans[i] == solution[i]:
        answer_list.append('T')
    elif ans[i] == '-':
        answer_list.append('-')
    else:
        answer_list.append('F')
true_ans = 0
false_ans = 0
not_do_ans = 0
point = 0
for i in answer_list:
    if i == 'F':
        false_ans += 1
        point -= wrong
    elif i == 'T':
        true_ans += 1
        point += point_per_unit
    elif i == '-':
        not_do_ans += 1
if point < 0:
    point = 0
print(true_ans,false_ans,not_do_ans,point)
# 0570, 2022-02-17 08:16:54, PP- (67%)

solution,point_per_unit,wrong = input().split(",")
point_per_unit = int(point_per_unit)
wrong = int(wrong)
ans = input()
answer_list = []
for i in range(len(ans)):
    if ans[i] == solution[i]:
        answer_list.append('T')
    elif ans[i] == '-':
        answer_list.append('-')
    elif ans[i] != solution[i]:
        answer_list.append('F')
    else:
        answer_list.append('-')
true_ans = 0
false_ans = 0
not_do_ans = 0
point = 0
for i in answer_list:
    if i == 'F':
        false_ans += 1
        point -= wrong
    elif i == 'T':
        true_ans += 1
        point += point_per_unit
    elif i == '-':
        not_do_ans += 1
if point < 0:
    point = 0
print(true_ans,false_ans,not_do_ans,point)

# 0571, 2022-02-17 08:09:05, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0572, 2022-02-17 08:10:46, --x (0%)

x = input().split(",")
y = input()
c = 0 ; d = 0 ; f = 0
score = 0
for i in range(len(x[0])):
  if x[0][i] == y[i]:
    score += int(x[1])
    c += 1
  elif x[0][i] == '-':  
    d += 1
  else:
    score -= int(x[1])
    f += 1
if score==0:
  score = 0
print(str(c), str(f), str(d), str(score))
# 0573, 2022-02-17 08:12:13, P-x (33%)

x = input().split(",")
y = input()
c = 0 ; d = 0 ; f = 0
score = 0
for i in range(len(x[0])):
  if x[0][i] == y[i]:
    score += int(x[1])
    c += 1
  elif x[0][i] == '-':  
    d += 1
  else:
    score -= int(x[2])
    f += 1
if score<0:
  score = 0
print(str(c), str(f), str(d), str(score))
# 0574, 2022-02-17 08:13:16, PPx (67%)

x = input().split(",")
y = input()
c = 0 ; d = 0 ; f = 0
score = 0
for i in range(len(x[0])):
  if x[0][i] == y[i]:
    score += int(x[1])
    c += 1
  elif y[i] == '-':  
    d += 1
  else:
    score -= int(x[2])
    f += 1
if score<0:
  score = 0
print(str(c), str(f), str(d), str(score))
# 0575, 2022-02-17 08:14:16, compilation error (0%)

ans,gain,deduct = input().split(',')
yourans = input()
unanswered = 0
true = 0
false = 0
for e in range(len(yourans)):
  if yourans[e] == ans[e]:
    true += 1
  elif yourans[e] != '-':
    false += 1
  else:
    unanswered += 1
unanswered += len(ans) - len(yourans)
score = int(gain)true - int(deduct) false
if score < 0:
    score = 0
print(true,false,unanswered,score)
# 0576, 2022-02-17 08:14:29, PPx (67%)

x = input().split(",")
y = input()
c = 0 ; d = 0 ; f = 0
score = 0
for i in range(len(x[0])):
  if x[0][i] == y[i]:
    score += int(x[1])
    c += 1
  elif y[i] == '-':  
    d += 1
  elif x[0][i] != y[i]:
    score -= int(x[2])
    f += 1
if score<0:
  score = 0
print(str(c), str(f), str(d), str(score))

# 0577, 2022-02-17 08:05:24, P-x (33%)

a,b,c=input().split(',')
d=input()
b,c = int(b),int(c)
correct=0
wrong=0
for i in range(len(a)):
    if d[i] == '-':
        continue
    if a[i] == d[i]:
        correct+=1
    else:
        wrong+=1
print(correct,wrong,c*wrong,b*correct)
# 0578, 2022-02-17 08:06:41, P-x (33%)

a,b,c=input().split(',')
d=input()
b,c = int(b),int(c)
correct=0
wrong=0
noans=0
for i in range(len(a)):
    if d[i] == '-':
        noans+=1
    if a[i] == d[i]:
        correct+=1
    else:
        wrong+=1
print(correct,wrong,noans,(b*correct)-(c*wrong))
# 0579, 2022-02-17 08:12:21, --x (0%)

[a,b,c],d=input().split(','),input()
c,w,n=0,0,0
for i in range(len(a)):
    n+=d[i] == '-'
    c+=a[i] == d[i]
    w+=a[i] != d[i]
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0580, 2022-02-17 08:13:59, PPx (67%)

[a,b,c],d=input().split(','),input()
cn,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        cn+=1
    else:
        w+=1
print(cn,w,n,(int(b)*cn)-(int(c)*w))
# 0581, 2022-02-17 08:15:59, --- (0%)

[a,b,c],d=input().split(','),input()
cn,w,n=0,0,0
for i in range(len(a)):
    if i < len(b):
        if d[i] == '-':
            n+=1
        elif a[i] == d[i]:
            cn+=1
        else:
            w+=1
    else:
        w+=1
print(cn,w,n,abs((int(b)*cn)-(int(c)*w)))

# 0582, 2022-02-17 08:09:23, P-x (33%)

key = input().split(',')
ans = input()
key1 = key[0]
pts = 0
correct = 0
wrong = 0
noans = 0
for i in range(len(key1)):
    if key1[i] == ans[i]:
        pts += int(key[1])
        correct += 1
    elif key1[i] == '-':
        noans += 1
    else: 
        pts -= int(key[2])
        wrong += 1
print(correct,wrong,noans,pts)



# 0583, 2022-02-17 08:13:21, PPx (67%)

key = input().split(',')
ans = input()
key1 = key[0]
pts = 0
correct = 0
wrong = 0
noans = 0
for i in range(len(key1)):
    if key1[i] == ans[i]:
        pts += int(key[1])
        correct += 1
    elif ans[i] == '-':
        noans += 1
    else: 
        pts -= int(key[2])
        wrong += 1
print(correct,wrong,noans,pts)



# 0584, 2022-02-17 08:14:06, xxx (0%)

key = input().split(',')
ans = input()
key1 = key[0]
pts = 0
correct = 0
wrong = 0
noans = 0
for i in range(len(key1)):
    if key1[i] == ans[i]:
        pts += int(key[1])
        correct += 1
    elif ans[i] == '-':
        noans += 1
    elif key[i] != ans[i]: 
        pts -= int(key[2])
        wrong += 1
print(correct,wrong,noans,pts)
# 0585, 2022-02-17 08:14:23, PPx (67%)

key = input().split(',')
ans = input()
key1 = key[0]
pts = 0
correct = 0
wrong = 0
noans = 0
for i in range(len(key1)):
    if key1[i] == ans[i]:
        pts += int(key[1])
        correct += 1
    elif ans[i] == '-':
        noans += 1
    else: 
        pts -= int(key[2])
        wrong += 1
print(correct,wrong,noans,pts)



# 0586, 2022-02-17 08:17:27, PP- (67%)

key = input().split(',')
ans = input()
key1 = key[0]
pts = 0
correct = 0
wrong = 0
noans = 0
for i in range(len(key1)):
    if len(ans) != len(key):
        ans += ' '
    if key1[i] == ans[i]:
        pts += int(key[1])
        correct += 1
    elif ans[i] == '-' or ans[i] == ' ':
        noans += 1
    else: 
        pts -= int(key[2])
        wrong += 1
print(correct,wrong,noans,pts)


# 0587, 2022-02-17 08:10:07, P-x (33%)

a = input().split(",")
b = input()
x = a[0]
c = 0
d = 0
e = 0
b = b + ("0"*(len(a)-len(b)))
for i in range (len(x)):
  if b[i] == x[i]:
    c += 1
  elif b[i] != x[i]:
    d += 1
  else:
    e += 1
point = (c*int(a[1]))-(d*int(a[2]))
print(c, d, e, point)
# 0588, 2022-02-17 08:10:19, P-x (33%)

a = input().split(",")
b = input()
x = a[0]
c = 0
d = 0
e = 0
b = b + ("0"*(len(a)-len(b)))
for i in range (len(x)):
  if b[i] == x[i]:
    c += 1
  elif b[i] != x[i]:
    d += 1
  else:
    e += 1
point = (c*int(a[1]))-(d*int(a[2]))
print(c, d, e, point)
# 0589, 2022-02-17 08:11:47, PPx (67%)

a = input().split(",")
b = input()
x = a[0]
c = 0
d = 0
e = 0
b = b + ("0"*(len(a)-len(b)))
for i in range (len(x)):
  if b[i] == x[i]:
    c += 1
  elif b[i] != x[i] and b[i] != "-":
    d += 1
  else:
    e += 1
point = (c*int(a[1]))-(d*int(a[2]))
print(c, d, e, point)
# 0590, 2022-02-17 08:16:38, PP- (67%)

a = input().split(",")
b = input()
x = a[0]
c = 0
d = 0
e = 0
b = b + ("0"*(len(x)-len(b)))
for i in range (len(x)):
  if b[i] == x[i]:
    c += 1
  elif b[i] != x[i] and b[i] != "-":
    d += 1
  else:
    e += 1
point = (c*int(a[1]))-(d*int(a[2]))
print(c, d, e, point)
# 0591, 2022-02-17 08:17:26, PP- (67%)

a = input().split(",")
b = input()
x = a[0]
c = 0
d = 0
e = 0
b = b + ("-"*(len(x)-len(b)))
for i in range (len(x)):
  if b[i] == x[i]:
    c += 1
  elif b[i] != x[i] and b[i] != "-":
    d += 1
  else:
    e += 1
point = (c*int(a[1]))-(d*int(a[2]))
print(c, d, e, point)

# 0592, 2022-02-17 08:06:27, PPx (67%)

x,y,z = input().split(',')
y = int(y)
z = int(z)
a = input()
t = 0
f = 0
n = 0
for i in range(len(x)):
    if a[i] == x[i]:
        t+=1
    elif a[i] == '-':
        n+=1
    else:
        f+=1

sum = t*y - f*z
if sum <= 0:
    sum = 0

print(t,f,n,sum)
# 0593, 2022-02-17 08:11:03, PPx (67%)

x,y,z = input().split(',')
y = int(y)
z = int(z)
a = input()
# if len(a) != len(x):
#     a += '0'*(len(x)-len(a))
# print(a)
t = 0
f = 0
n = 0
for i in range(len(x)):
    if a[i] == x[i]:
        t+=1
    elif a[i] == '-':
        n+=1

    else:
        f+=1

sum = t*y - f*z
# if sum <= 0:
#     sum = 0

print(t,f,n,sum)
# 0594, 2022-02-17 08:14:46, --- (0%)

x,y,z = input().split(',')
y = int(y)
z = int(z)
a = input()
n = len(x)-len(a)
if len(a) != len(x):
    a += '0'*(len(x)-len(a))
print(a)
t = 0
f = 0

for i in range(len(x)):
    if a[i] == x[i]:
        t+=1
    elif a[i] == '-':
        n+=1
    elif a[i] == '0':
        pass
    else:
        f+=1

sum = t*y - f*z
if sum <= 0:
    sum = 0

print(t,f,n,sum)


# 0595, 2022-02-17 08:14:54, PPx (67%)

x,y,z = input().split(',')
y = int(y)
z = int(z)
a = input()
# if len(a) != len(x):
#     a += '0'*(len(x)-len(a))
# print(a)
t = 0
f = 0
n = 0
for i in range(len(x)):
    if a[i] == x[i]:
        t+=1
    elif a[i] == '-':
        n+=1

    else:
        f+=1

sum = t*y - f*z
# if sum <= 0:
#     sum = 0

print(t,f,n,sum)

# 0596, 2022-02-17 08:15:53, PPx (67%)

x,y,z = input().split(',')
y = int(y)
z = int(z)
a = input()
# if len(a) != len(x):
#     a += '0'*(len(x)-len(a))
# print(a)
t = 0
f = 0
n = 0
for i in range(len(x)):
    if a[i] == x[i]:
        t+=1
    elif a[i] == '-':
        n+=1

    else:
        f+=1

sum = t*y - f*z
if sum <= 0:
    sum = 0

print(t,f,n,sum)

# 0597, 2022-02-17 08:13:13, P-- (33%)

n0,n1,n2=input().split(',')
y=input()
k=0
miss=0
p=0
n=0

for i in range(len(n0)):
    if len(y) != len(n0):
        y += 'P'
        miss+=1
    if y[i]=='-':
        miss+=1
        n-=1
for i in range(len(n0)):
    if y[i]==n0[i]:
        k+=int(n1)
        p+=1
    else:
        k-=int(n2)
        n+=1
if k<0:
    k=0
print(p,n,miss,k)
# 0598, 2022-02-17 08:15:47, PP- (67%)

n0,n1,n2=input().split(',')
y=input()
k=0
miss=0
p=0
n=0

for i in range(len(n0)):
    if len(y) != len(n0):
        y += 'P'
        miss+=1
    if y[i]=='-':
        miss+=1
        n-=1
for i in range(len(n0)):
    if y[i]==n0[i]:
        k+=int(n1)
        p+=1
    elif y[i]=='-':
        n+=1
    else:
        k -= int(n2)
        n += 1
if k<0:
    k=0
print(p,n,miss,k)
# 0599, 2022-02-17 08:16:25, PP- (67%)

n0,n1,n2=input().split(',')
y=input()
k=0
miss=0
p=0
n=0

for i in range(len(n0)):
    if len(y) != len(n0):
        y += 'P'
        miss+=1
    if y[i]=='-':
        miss+=1
        n-=1
for i in range(len(n0)):
    if y[i]==n0[i]:
        k+=int(n1)
        p+=1
    elif y[i]=='-' or y[i]=='P':
        n+=1
    else:
        k -= int(n2)
        n += 1
if k<0:
    k=0
print(p,n,miss,k)
# 0600, 2022-02-17 08:16:49, PP- (67%)

n0,n1,n2=input().split(',')
y=input()
k=0
miss=0
p=0
n=0

for i in range(len(n0)):
    if len(y) != len(n0):
        y += 'P'
        miss+=1
    if y[i]=='-':
        miss+=1
        n-=1
for i in range(len(n0)):
    if y[i]==n0[i]:
        k+=int(n1)
        p+=1
    elif y[i]=='-' or y[i]=='P':
        n+=1
    else:
        k -= int(n2)
        n += 1
if k<0:
    k=0
print(p,n,miss,k)
# 0601, 2022-02-17 08:17:12, PP- (67%)

n0,n1,n2=input().split(',')
y=input()
k=0
miss=0
p=0
n=0

for i in range(len(n0)):
    if len(y) != len(n0):
        y += 'P'
        miss+=1
    if y[i]=='-':
        miss+=1
        n-=1
for i in range(len(n0)):
    if y[i]==n0[i]:
        k+=int(n1)
        p+=1
    elif y[i]=='-' or y[i]=='P':
        n+=1
    else:
        k -= int(n2)
        n += 1
if k<0:
    k=0
print(p,n,miss,k)

# 0602, 2022-02-17 08:08:21, --x (0%)

key,correct,wrong = input().split(",")
student = input()
score = 0
count = 0
for i in range(len(key)):
    if student[i] == key[i]:
        count += 1
# 0603, 2022-02-17 08:13:58, --x (0%)

key,correct,wrong = input().split(",")
student = input()
score = 0
count = 0
t = 0
f = 0
for i in range(len(key)):
    if student[i] == key[i]:
        count += 1
for n in range(len(key)):
    if student[n] == "T":
        t += 1
        print(t)
    break
for n in range(len(key)):
    if student[n] == "F":
        f += 1
        print(f)
    break
# 0604, 2022-02-17 08:15:39, xxx (0%)

S=input().split(",")
std=input()
a=S[0]
i=0
score=0
cor=0
m=0
f=0

while i<len(std) :
    if a[i]==std[i] :
        score+=int(S[1])
        cstdr+=1
    elif std[i]=="-" :
        score=score+0
        m+=1
    else :
        score-=int(S[2])
        f += 1
    i+=1

print(cor,f,m,score)\
# 0605, 2022-02-17 08:15:52, xxx (0%)

S=input().split(",")
std=input()
a=S[0]
i=0
score=0
cor=0
m=0
f=0

while i<len(std) :
    if a[i]==std[i] :
        score+=int(S[1])
        cstdr+=1
    elif std[i]=="-" :
        score=score+0
        m+=1
    else :
        score-=int(S[2])
        f += 1
    i+=1

print(cor,f,m,score)\
# 0606, 2022-02-17 08:17:20, PP- (67%)

n=input().split(",")
X=input()
a=n[0]
i=0
score=0
cor=0
m=0
fal=0

while i<len(X) :
    if a[i]==X[i] :
        score+=int(n[1])
        cor+=1
    elif X[i]=="-" :
        score=score+0
        m+=1
    else :
        score-=int(n[2])
        fal+=1
    i+=1

print(cor,fal,m,score)\

# 0607, 2022-02-17 08:14:59, xxx (0%)

x=input().split(",")
y=[x[0]]+[int(x[1])]+[int(x[2])]
ans=input()
c=0
n=0
w=0
for i in range(len(ans)):
    if ans[i]==y[0][i]:
        c+=1
    elif ans[i]=="-":
        n+=1
    else:
        cw+=1
t=(c*y[1])-(w*y[2])
if t <0:
    t=0
print(c,w,n,pt)
# 0608, 2022-02-17 08:15:16, PP- (67%)

x=input().split(",")
tans=[x[0]]+[int(x[1])]+[int(x[2])]
ans=input()
cc=0
cn=0
cw=0
for i in range(len(ans)):
    if ans[i]==tans[0][i]:
        cc+=1
    elif ans[i]=="-":
        cn+=1
    else:
        cw+=1
pt=(cc*tans[1])-(cw*tans[2])
if pt <0:
    pt=0
print(cc,cw,cn,pt)
# 0609, 2022-02-17 08:15:27, PP- (67%)

x=input().split(",")
tans=[x[0]]+[int(x[1])]+[int(x[2])]
ans=input()
cc=0
cn=0
cw=0
for i in range(len(ans)):
    if ans[i]==tans[0][i]:
        cc+=1
    elif ans[i]=="-":
        cn+=1
    else:
        cw+=1
pt=(cc*tans[1])-(cw*tans[2])
if pt <0:
    pt=0
print(cc,cw,cn,pt)
# 0610, 2022-02-17 08:15:57, PP- (67%)

x=input().split(",")
tans=[x[0]]+[int(x[1])]+[int(x[2])]
ans=input()
cc=0
cn=0
cw=0
for i in range(len(ans)):
    if ans[i]==tans[0][i]:
        cc+=1
    elif ans[i]=="-":
        cn+=1
    else:
        cw+=1
pt=(cc*tans[1])-(cw*tans[2])
if pt <0:
    pt=0
print(cc,cw,cn,pt)

# 0611, 2022-02-17 08:09:41, xxx (0%)

sol_ = input().split(',')
sol = sol_[0]
pointt = sol_[1]
pointf = sol[2]
ans = input()
t = 0
f = 0
d = 0

for i in range(len(ans)):
    if ans[i] == sol[i]:
        t += 1
    elif ans[i] == '-':
        d += 1
    else :
        f += 1
point = int(pointt)*t + int(pointf)*f
print(t, f, d, point)
# 0612, 2022-02-17 08:10:38, P-- (33%)

sol_ = input().split(',')
sol = sol_[0]
pointt = sol_[1]
pointf = sol_[2]
ans = input()
t = 0
f = 0
d = 0

for i in range(len(ans)):
    if ans[i] == sol[i]:
        t += 1
    elif ans[i] == '-':
        d += 1
    else :
        f += 1
point = int(pointt)*t + int(pointf)*f
print(t, f, d, point)
# 0613, 2022-02-17 08:13:36, P-- (33%)

sol_ = input().split(',')
sol = sol_[0]
pointt = sol_[1]
pointf = sol_[2]
ans = input()
t = 0
f = 0
d = 0

for i in range(len(ans)):
    if ans[i] == sol[i]:
        t += 1
    elif ans[i] == '-':
        d += 1
    else :
        f += 1
if len(sol) - len(ans) != 0:
    d += len(sol) - len(ans)
point = int(pointt)*t + int(pointf)*f
print(t, f, d, point)
# 0614, 2022-02-17 08:14:05, PP- (67%)

sol_ = input().split(',')
sol = sol_[0]
pointt = sol_[1]
pointf = sol_[2]
ans = input()
t = 0
f = 0
d = 0

for i in range(len(ans)):
    if ans[i] == sol[i]:
        t += 1
    elif ans[i] == '-':
        d += 1
    else :
        f += 1
if len(sol) - len(ans) != 0:
    d += len(sol) - len(ans)
point = int(pointt)*t - int(pointf)*f
print(t, f, d, point)

# 0615, 2022-02-17 08:12:02, PP- (67%)

S=input().split(",")
X=input()
a=S[0]
i=0
score=0
cor=0
m=0
fal=0

while i<len(X) :
    if a[i]==X[i] :
        score+=int(S[1])
        cor+=1
    elif X[i]=="-" :
        score=score+0
        m+=1
    else :
        score-=int(S[2])
        fal+=1
    i+=1
    
print(cor,fal,m,score)
# 0616, 2022-02-17 08:13:09, xxx (0%)

S=input().split(",")
X=input()
a=S[0]
i=0
score=0
cor=0
m=0
fal=0

while i<=len(X) :
    if a[i]==X[i] :
        score+=int(S[1])
        cor+=1
    elif X[i]=="-" :
        score=score+0
        m+=1
    else :
        score-=int(S[2])
        fal+=1
    i+=1
    
print(cor,fal,m,score)
# 0617, 2022-02-17 08:14:46, PP- (67%)

S=input().split(",")
X=input()
a=S[0]
i=0
score=0
cor=0
m=0
fal=0

while i<len(X) :
    if a[i]==X[i] :
        score+=int(S[1])
        cor+=1
    elif X[i]=="-" or X[i]==" ":
        score=score+0
        m+=1
    else :
        score-=int(S[2])
        fal+=1
    i+=1
    
print(cor,fal,m,score)
# 0618, 2022-02-17 08:15:07, PPx (67%)

S=input().split(",")
X=input()
a=S[0]
i=0
score=0
cor=0
m=0
fal=0

while i<len(a) :
    if a[i]==X[i] :
        score+=int(S[1])
        cor+=1
    elif X[i]=="-" or X[i]==" ":
        score=score+0
        m+=1
    else :
        score-=int(S[2])
        fal+=1
    i+=1
    
print(cor,fal,m,score)

# 0619, 2022-02-17 08:06:06, --x (0%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if ans[i] == check[i] :
    score += cor
    c += 1
  elif ans[i] != check[i] :
    if check[i] == '-':
      d += 1
    else:
      w += 0
print(c, w, d, score)
# 0620, 2022-02-17 08:08:07, P-x (33%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if ans[i] == check[i] :
    score += cor
    c += 1
  elif ans[i] != check[i] :
    if check[i] == '-':
      d += 1
    else:
      w += 1
print(c, w, d, score)
# 0621, 2022-02-17 08:09:56, P-x (33%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if len(ans) != len(check) : 
    d += len(ans) - len(check)
  if ans[i] == check[i] :
    score += cor
    c += 1
  elif ans[i] != check[i] :
    if check[i] == '-':
      d += 1
    else:
      w += 1
print(c, w, d, score)
# 0622, 2022-02-17 08:12:46, PP- (67%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if len(ans) != len(check) : 
    d += len(ans) - len(check)
  if len(ans) == len(check):
    if ans[i] == check[i] :
      score += cor
      c += 1
    elif ans[i] != check[i] :
      if check[i] == '-':
        d += 1
      else:
        w += 1
        score -= wro
print(c, w, d, score)

# 0623, 2022-02-17 08:10:53, PP- (67%)

a = input().split(",")
b = input()
c = int(a[1])
d = int(a[2])
f = a[0]
i = 0
t = 0
fa = 0
n = 0
for e in b:
    if e == f[i] :
        t += 1
    elif e != f[i] and e!= '-' :
        fa += 1
    elif e == '-':
        n +=1
    i += 1
s = (t*c)-(fa*d)
print(t,fa,n,s)
# 0624, 2022-02-17 08:11:57, PP- (67%)

a = input().split(",")
b = input()
c = int(a[1])
d = int(a[2])
f = a[0]
i = 0
t = 0
fa = 0
n = 0
for e in b:
    if e == f[i] :
        t += 1
    elif e != f[i] and e!= '-' and e !=  ' ' :
        fa += 1
    elif e == '-' or e == ' ' :
        n +=1
    i += 1
s = (t*c)-(fa*d)
print(t,fa,n,s)
# 0625, 2022-02-17 08:14:37, xxx (0%)

a = input().split(",")
b = input()
c = int(a[1])
d = int(a[2])
f = a[0]
b = b + '-'*len(f)
i = 0
t = 0
fa = 0
n = 0
for e in b:
    if e == f[i] :
        t += 1
    elif e != f[i] and e!= '-' and e !=  ' ' :
        fa += 1
    elif e == '-' or e == ' ' :
        n +=1
    i += 1
s = (t*c)-(fa*d)
print(t,fa,n,s)
# 0626, 2022-02-17 08:14:47, PP- (67%)

a = input().split(",")
b = input()
c = int(a[1])
d = int(a[2])
f = a[0]
i = 0
t = 0
fa = 0
n = 0
for e in b:
    if e == f[i] :
        t += 1
    elif e != f[i] and e!= '-' and e !=  ' ' :
        fa += 1
    elif e == '-' or e == ' ' :
        n +=1
    i += 1
s = (t*c)-(fa*d)
print(t,fa,n,s)

# 0627, 2022-02-17 08:07:28, P-- (33%)

first = input()
ans = input()
c = 0
correct = 0
wrong = 0
miss =0
for i in range(len(ans)):
    if first[i]==ans[i]:
        c = c+int(first[-3])
        correct +=1
    elif ans[i]==" ":
        miss = miss+1
    else:
        c = c-int(first[-1])
        wrong +=1
if c<0:
    c==0
print(correct,wrong,miss,c)

# 0628, 2022-02-17 08:12:34, PP- (67%)

first = input()
ans = input()
c = 0
correct = 0
wrong = 0
miss =0
for i in range(len(ans)):
    if first[i]==ans[i]:
        c = c+int(first[-3])
        correct +=1
    if ans[i]=="-":
        miss = miss+1
    elif first[i] != ans[i]:
        c = c-int(first[-1])
        wrong +=1
if c<0:
    c==0
if len(first[:-4:])!= len(ans):
    wrong = wrong+len(first[:-4:])-len(ans)
print(correct,wrong,miss,c)

# 0629, 2022-02-17 08:13:49, PP- (67%)

first = input()
ans = input()
c = 0
correct = 0
wrong = 0
miss =0
for i in range(len(ans)):
    if first[i]==ans[i]:
        c = c+int(first[-3])
        correct +=1
    if ans[i]=="-":
        miss = miss+1
    elif first[i] != ans[i]:
        c = c-int(first[-1])
        wrong +=1
if c<0:
    c==0
if len(first[:-4:])!= len(ans):
    miss = miss+len(first[:-4:])-len(ans)
print(correct,wrong,miss,c)

# 0630, 2022-02-17 08:16:48, PP- (67%)

first = input()
ans = input()
c = 0
correct = 0
wrong = 0
miss =0
for i in range(len(ans)):
    if first[i]==ans[i]:
        c = c+int(first[-3])
        correct +=1
    if ans[i]=="-":
        miss = miss+1
    elif first[i] != ans[i] and ans[i]!="-":
        c = c-int(first[-1])
        wrong +=1
if c<0:
    c==0
if len(first[:-4:])!= len(ans):
    miss = miss+len(first[:-4:])-len(ans)
print(correct,wrong,miss,c)


# 0631, 2022-02-17 08:08:39, xxx (0%)

a=str(input())
r=str(input())
t=0
f=0
p=0
for i in range(len(a)-4):
    if r[i]==a[i]:
        t+=1
    elif r[i]=='-':
        p+=1
    else:
        f+=1
print(str(t)+' '+str(f)+' '+str(p)+' '+str(t*a[-3]-f*a[-1]))
# 0632, 2022-02-17 08:10:48, PPx (67%)

a=str(input())
r=str(input())
t=0
f=0
p=0
for i in range(len(a)-4):
    if r[i]==a[i]:
        t+=1
    elif r[i]=='-':
        p+=1
    else:
        f+=1
print(str(t)+' '+str(f)+' '+str(p)+' '+str(t*int(a[-3])-f*int(a[-1])))

# 0633, 2022-02-17 08:14:26, --x (0%)

a=str(input())
r=str(input())
t=0
f=0
p=0
for i in range(len(a)-4):
    if r[i]==a[i]:
        t+=1
    elif r[i]=='-':
        p+=1
    elif len(r)<len(a):
        p+=int(len(a)-len(r))
    else:
        f+=1
print(str(t)+' '+str(f)+' '+str(p)+' '+str(t*int(a[-3])-f*int(a[-1])))
# 0634, 2022-02-17 08:15:34, --- (0%)

a=str(input())
r=str(input())
t=0
f=0
p=0
for i in range(len(a)-4):
    if len(r)<len(a):
        p+=int(len(a)-len(r))
    elif r[i]==a[i]:
        t+=1
    elif r[i]=='-':
        p+=1
    else:
        f+=1
print(str(t)+' '+str(f)+' '+str(p)+' '+str(t*int(a[-3])-f*int(a[-1])))


# 0635, 2022-02-17 08:10:48, PPx (67%)

a1,a2,a3 = input().split(",")
b = input()
c = 0
d = 0
e = 0
for k in range(len(a1)):
  if b[k] == a1[k]:
    c += 1
  elif b[k] == "-":
    d += 1
  else:
    e += 1
sc = c*int(a2) - e*int(a3)
print(c,e,d,sc)
# 0636, 2022-02-17 08:11:28, --x (0%)

a1,a2,a3 = input().split(",")
b = input()
c = 0
d = 0
e = 0
for k in range(len(a1)):
  if b[k] == a1[k]:
    c += 1
  elif b[k] == "-":
    d += 1
  else:
    e += 1
sc = c*float(a2) - e*float(a3)
print(c,e,d,sc)
# 0637, 2022-02-17 08:13:37, PPx (67%)

a1,a2,a3 = input().split(",")
b = input()
c = 0
d = 0
e = 0
for k in range(len(a1)):
  if b[k] == a1[k]:
    c += 1
  elif b[k] == "-":
    d += 1
  else:
    e += 1
sc = c*float(a2) - e*float(a3)
print(c,e,d,int(sc))
# 0638, 2022-02-17 08:16:14, xxx (0%)

a1,a2,a3 = input().split(",")
b = input()
c = 0
d = 0
e = 0
for k in range(len(a1)):
  if b[k] == a1[k]:
    c += 1
  elif b[k] == "-":
    d += 1
  else:
    e += 1
sc = c*float(a2) - e*float
if sc < 0:
  sc = 0
print(c,e,d,int(sc))

# 0639, 2022-02-17 08:08:31, xxx (0%)

n=input().split(',')
ans=input()
P=n[1]
deP=n[2]
total=0
tr=0
nt=0
fa=0

for i in range(len(n[0])):
    if ans[i]==n[0][i]:
       total+=P
       tr+=1
    elif ans[i]=='-':
        nt+=1
        pass
    else:
        total-=deP
        fa+=1
print(tr,fa,nt,total)
# 0640, 2022-02-17 08:09:36, PPx (67%)

n=input().split(',')
ans=input()
P=int(n[1])
deP=int(n[2])
total=0
tr=0
nt=0
fa=0

for i in range(len(n[0])):
    if ans[i]==n[0][i]:
       total+=P
       tr+=1
    elif ans[i]=='-':
        nt+=1
        pass
    else:
        total-=deP
        fa+=1
print(tr,fa,nt,total)
# 0641, 2022-02-17 08:14:58, --- (0%)

n=input().split(',')
ans=input()
P=int(n[1])
deP=int(n[2])
total=0
tr=0
nt=0
fa=0

for i in range(len(ans)):
    if ans[i]==n[0][i]:
       total+=P
       tr+=1
    elif ans[i]=='-' :
        nt+=1
        pass
    else:
        total-=deP
        fa+=1
fa=nt
nt=5-tr-fa
print(tr,fa,nt,total)
# 0642, 2022-02-17 08:15:34, PP- (67%)

n=input().split(',')
ans=input()
P=int(n[1])
deP=int(n[2])
total=0
tr=0
nt=0
fa=0

for i in range(len(ans)):
    if ans[i]==n[0][i]:
       total+=P
       tr+=1
    elif ans[i]=='-' :
        nt+=1
        pass
    else:
        total-=deP
        fa+=1
if len(n[0])!=len(ans): 
  fa=nt
  nt=5-tr-fa
print(tr,fa,nt,total)

# 0643, 2022-02-17 08:14:29, xxx (0%)

a = input().split(',')
b = input()

a1 = str(a[0])
at1 = 0
at2 = 0
at3 = 0

for i in range(len(b)):
    if a1[i] == b[i]:
        at1 += 1
    elif b[i] == '-':
        at3 += 1
    elif a1[i] != b[i]:
        at2 += 1

if len(a1) != len(b):
    at3 += (int(len(a1)) - int(len(b)))
    
at4 = int(at1)*int(a1[1]) - int(at2)*int(a1[2])

print(at1 + ' ' + at2 + ' ' + at3 + ' ' +at4)
# 0644, 2022-02-17 08:15:11, xxx (0%)

a = input().split(',')
b = input()

a1 = str(a[0])
at1 = 0
at2 = 0
at3 = 0

for i in range(len(b)):
    if a1[i] == b[i]:
        at1 += 1
    elif b[i] == '-':
        at3 += 1
    elif a1[i] != b[i]:
        at2 += 1

if len(a1) != len(b):
    at3 += (int(len(a1)) - int(len(b)))
    
at4 = int(at1)*int(a[1]) - int(at2)*int(a[2])

print(at1 + ' ' + at2 + ' ' + at3 + ' ' +at4)
# 0645, 2022-02-17 08:16:02, PP- (67%)

a = input().split(',')
b = input()

a1 = str(a[0])
at1 = 0
at2 = 0
at3 = 0

for i in range(len(b)):
    if a1[i] == b[i]:
        at1 += 1
    elif b[i] == '-':
        at3 += 1
    elif a1[i] != b[i]:
        at2 += 1

if len(a1) != len(b):
    at3 += (int(len(a1)) - int(len(b)))
    
at4 = int(at1)*int(a[1]) - int(at2)*int(a[2])

print(str(at1) + ' ' + str(at2) + ' ' + str(at3) + ' ' +str(at4))
# 0646, 2022-02-17 08:16:15, PP- (67%)

a = input().split(',')
b = input()

a1 = str(a[0])
at1 = 0
at2 = 0
at3 = 0

for i in range(len(b)):
    if a1[i] == b[i]:
        at1 += 1
    elif b[i] == '-':
        at3 += 1
    elif a1[i] != b[i]:
        at2 += 1

if len(a1) != len(b):
    at3 += (int(len(a1)) - int(len(b)))
    
at4 = int(at1)*int(a[1]) - int(at2)*int(a[2])

print(str(at1) + ' ' + str(at2) + ' ' + str(at3) + ' ' + str(at4))

# 0647, 2022-02-17 08:11:18, P-x (33%)

q, t, f  = input().split(',')
a = input()
t = int(t)
f = int(f)
k = 0
s = 0
c_s = 0
r_s = 0
d = 0
for i in q:
    if i == a[k]:
        s += t
        c_s +=1
    elif i == '-':
        d += 1
    else:
        s -= f
        r_s += 1
    k+=1
print(c_s, r_s, d, s)


# 0648, 2022-02-17 08:12:23, P-x (33%)

q, t, f  = input().split(',')
a = input()
t = int(t)
f = int(f)
k = 0
s = 0
c_s = 0
r_s = 0
d = 0
for i in q:
    if i == a[k]:
        s += t
        c_s +=1
    elif i == '-':
        d += 1
    else:
        s -= f
        r_s += 1
    k+=1
if s < 0:
    s = 0
print(c_s, r_s, d, s)



# 0649, 2022-02-17 08:15:06, P-x (33%)

q, t, f  = input().split(',')
a = input()
t = int(t)
f = int(f)
k = 0
s = 0
c_s = 0
r_s = 0
d = 0
for i in q:
    if i == a[k]:
        s += t
        c_s +=1
    elif i == '-':
        d += 1
    else:
        s -= f
        r_s += 1
    k+=1
if s < 0:
    s = 0
print(c_s, r_s, d, s)



# 0650, 2022-02-17 08:17:19, PPx (67%)

q, t, f  = input().split(',')
a = input()
t = int(t)
f = int(f)
k = 0
s = 0
c_s = 0
r_s = 0
d = 0
for i in q:
    if a[k] == i:
        s += t
        c_s +=1
    elif a[k] == '-':
        d += 1
    else:
        s -= f
        r_s += 1
    k+=1
if s < 0:
    s = 0
print(c_s, r_s, d, s)




# 0651, 2022-02-17 08:09:07, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0652, 2022-02-17 08:12:52, compilation error (0%)

a = input().split(",")
b = input()
c = 0
d = 0
e = 0
m = len(a[0])
a[0] = x
for i in range(m):
    if x[i] == b[[i]:
                c += 1
    elif b[i] == "-":
                e += 1
    else :
                d += 1
y = int(a[1])*c - int(a[2])*d
print(c,d,e,y)
    
                 
                 
    
# 0653, 2022-02-17 08:13:47, PPx (67%)

x = input().split(",")
y = input()
c = 0 ; d = 0 ; f = 0
score = 0
for i in range(len(x[0])):
  if x[0][i] == y[i]:
    score += int(x[1])
    c += 1
  elif y[i] == '-':  
    d += 1
  else:
    score -= int(x[2])
    f += 1
if score<0:
  score = 0
print(str(c), str(f), str(d), str(score))
# 0654, 2022-02-17 08:14:14, PPx (67%)

x = input().split(",")
y = input()
c = 0 ; d = 0 ; f = 0
score = 0
for i in range(len(x[0])):
  if x[0][i] == y[i]:
    score += int(x[1])
    c += 1
  elif y[i] == '-':  
    d += 1
  else:
    score -= int(x[2])
    f += 1
if score<0:
  score = 0
print(str(c), str(f), str(d), str(score))

# 0655, 2022-02-17 08:14:59, TTT (0%)

s=input()
a,b,c=s.split(',')
t=input()
k=0
x=0
y=0
z=0
u=0
while True:
    if a[k]==t[k]:
        k+=1
        x+=1
        z+=int(b)
    if a[k]!=t[k-1] and t[k-1]!='-':
        k+=1
        y+=1
        z-=int(c)
    if t[k]=='-' :
        u+=1
        k+=1
    if k==len(t):break
print(x,y,u,z)
        
# 0656, 2022-02-17 08:15:25, TTT (0%)

s=input()
a,b,c=s.split(',')
t=input()
k=0
x=0
y=0
z=0
u=0
while True:
    if a[k]==t[k]:
        k+=1
        x+=1
        z+=int(b)
    elif a[k]!=t[k-1] and t[k-1]!='-':
        k+=1
        y+=1
        z-=int(c)
    elif t[k]=='-' :
        u+=1
        k+=1
    if k==len(t):break
print(x,y,u,z)
# 0657, 2022-02-17 08:15:57, --- (0%)

s=input()
a,b,c=s.split(',')
t=input()
k=0
x=0
y=0
z=0
u=0
while True:
    if a[k]==t[k]:
        x+=1
        z+=int(b)
    elif a[k]!=t[k-1] and t[k-1]!='-':
        y+=1
        z-=int(c)
    elif t[k]=='-' :
        u+=1
    k+=1
    if k==len(t):break
print(x,y,u,z)
# 0658, 2022-02-17 08:16:04, PP- (67%)

s=input()
a,b,c=s.split(',')
t=input()
k=0
x=0
y=0
z=0
u=0
while True:
    if a[k]==t[k]:
        x+=1
        z+=int(b)
    elif a[k]!=t[k] and t[k]!='-':
        y+=1
        z-=int(c)
    elif t[k]=='-' :
        u+=1
    k+=1
    if k==len(t):break
print(x,y,u,z)

# 0659, 2022-02-17 08:10:29, PPx (67%)

q=input().split(',')
a=input()

b=q[0]
c=0
d=0
e=0
for i in range(len(b)):
    if a[i]==b[i]:
        c+=1
    elif a[i]=='-' or a[i]=='':
        e+=1
    elif a[i]!=b[i]:
        d+=1

s=(c*int(q[1]))-(d*int(q[2]))

print(c,d,e,s)
# 0660, 2022-02-17 08:14:09, PP- (67%)

q=input().split(',')
a=input()

b=q[0]
c=0
d=0
e=0

if len(b)==len(a):
    for i in range(len(b)):
        if a[i]==b[i]:
            c+=1
        elif a[i]=='-' or a[i]=='':
            e+=1
        elif a[i]!=b[i]:
            d+=1
elif len(a)<len(b):
    for i in range(len(a)):
        if a[i]==b[i]:
            c+=1
        elif a[i]=='-' or a[i]=='':
            e+=1
        elif a[i]!=b[i]:
            d+=1
    e+=len(b)-len(a)

s=(c*int(q[1]))-(d*int(q[2]))

print(c,d,e,s)
# 0661, 2022-02-17 08:17:04, --- (0%)

q=input().split(',')
a=input()

b=q[0]
c=0
d=0
e=0

if len(b)==len(a):
    for i in range(len(b)):
        if a[i]==b[i]:
            c+=1
        elif a[i]=='-' or a[i]=='':
            e+=1
        elif a[i]!=b[i]:
            d+=1
elif len(a)<len(b):
    for i in range(len(a)):
        if a[i]==b[i]:
            c+=1
        elif a[i]=='-' or a[i]=='':
            e+=1
        elif a[i]!=b[i]:
            d+=1
    e+=len(b)-len(a)


s=(c*int(q[1]))-(d*int(q[2]))
if s>=0:
    print(s)
else: print(0)
# 0662, 2022-02-17 08:17:29, --- (0%)

q=input().split(',')
a=input()

b=q[0]
c=0
d=0
e=0

if len(b)==len(a):
    for i in range(len(b)):
        if a[i]==b[i]:
            c+=1
        elif a[i]=='-' or a[i]=='':
            e+=1
        elif a[i]!=b[i]:
            d+=1
elif len(a)<len(b):
    for i in range(len(a)):
        if a[i]==b[i]:
            c+=1
        elif a[i]=='-' or a[i]=='':
            e+=1
        elif a[i]!=b[i]:
            d+=1
    e+=len(b)-len(a)



print(0)

# 0663, 2022-02-17 08:08:08, compilation error (0%)

a=input()
minus=int(a[-1])
plus=int(a[-3])
b=input()
p=0
y,n,s=0,0,s
for i in range(len(a)-4):
    if a[i]==b[i]:
    p+=plus
    y+=1
    if b[i]!=a[i]:
        if b[i]=="-":
            p+=0
            s+=1
        else:
            p-=minus
            n+=1
print(y,n,s,p)
# 0664, 2022-02-17 08:08:37, xxx (0%)

a=input()
minus=int(a[-1])
plus=int(a[-3])
b=input()
p=0
y,n,s=0,0,s
for i in range(len(a)-4):
    if a[i]==b[i]:
        p+=plus
        y+=1
    if b[i]!=a[i]:
        if b[i]=="-":
            p+=0
            s+=1
        else:
            p-=minus
            n+=1
print(y,n,s,p)
# 0665, 2022-02-17 08:09:54, PPx (67%)

a=input()
minus=int(a[-1])
plus=int(a[-3])
b=input()
p=0
y,n,s=0,0,0
for i in range(len(a)-4):
    if a[i]==b[i]:
        p+=plus
        y+=1
    if b[i]!=a[i]:
        if b[i]=="-":
            s+=1
        else:
            p-=minus
            n+=1
print(y,n,s,p)
# 0666, 2022-02-17 08:16:11, PP- (67%)

a=input()
minus=int(a[-1])
plus=int(a[-3])
b=input()
p=0
y,n=0,0
s=len(a)-4-len(b)
for i in range(len(b)):
    if b[i]==a[i]:
        p+=plus
        y+=1
    elif b[i]!=a[i]:
        if b[i]=="-":
            s+=1
        else:
            p-=minus
            n+=1
print(y,n,s,p)

# 0667, 2022-02-17 08:08:23, xxx (0%)

x1=split(',').input()
x2=input()
c=0
tr=0
fl=0
nodo=str(len(x1)-len(x2))
while i < len(x2):
    
    if x2[i] == x1[i]:
        c += int(x1[1])
        tr+=1
    if x2[i] != x1[i]:
        c -= int(x1[2])
        fl+=1
    i += 1

print(str(tr),str(fl),nodo,str(c))
# 0668, 2022-02-17 08:09:06, xxx (0%)

x1=input().split(',')
x2=input()
c=0
tr=0
fl=0
nodo=str(len(x1)-len(x2))
while i < len(x2):
    
    if x2[i] == x1[i]:
        c += int(x1[1])
        tr+=1
    if x2[i] != x1[i]:
        c -= int(x1[2])
        fl+=1
    i += 1

print(str(tr),str(fl),nodo,str(c))

# 0669, 2022-02-17 08:12:45, PP- (67%)

S=input().split(",")
X=input()
a=S[0]
i=0
score=0
cor=0
m=0
fal=0

while i<len(X) :
    if a[i]==X[i] :
        score+=int(S[1])
        cor+=1
    elif X[i]=="-" :
        score=score+0
        m+=1
    else :
        score-=int(S[2])
        fal+=1
    i+=1

print(cor,fal,m,score)\

# 0670, 2022-02-17 08:08:45, --- (0%)

Ans = input().split(',')
Test = input()
Mark = 0
Correct = 0
Wrong = 0
Not = 0
for i in range(len(Test)):
    if Test[i] == Ans[0][i]:
        Mark += int(Ans[1])
        Correct += 1
    elif Test[i] != Ans[0][i] and Test[i] in ['T','F']:
        Mark -= int(Ans[1])
        Wrong += 1
    else:
        Not += 1
print('{} {} {} {}'.format(Correct,Wrong,Not,Mark))

# 0671, 2022-02-17 08:14:11, PP- (67%)

Ans = input().split(',')
Test = input()
Mark = 0
Correct = 0
Wrong = 0
Not = 0
for i in range(len(Test)):
    if Test[i] == (Ans[0])[i]:
        Mark += int(Ans[1])
        Correct += 1
    elif Test[i] !=( Ans[0])[i] and Test[i] in ['T','F']:
        Mark -= int(Ans[2])
        Wrong += 1
    else:
        Not += 1
if len(Test) < len(Ans[1]):
    Not += len(Ans[1]) - len(Test)
print('{} {} {} {}'.format(Correct,Wrong,Not,Mark))

# 0672, 2022-02-17 08:16:04, PP- (67%)

Ans = input().split(',')
Test = input()
Mark = 0
Correct = 0
Wrong = 0
Not = 0
for i in range(len(Test)):
    if Test[i] == (Ans[0])[i]:
        Mark += int(Ans[1])
        Correct += 1
    elif Test[i] !=( Ans[0])[i] and Test[i] in ['T','F']:
        Mark -= int(Ans[2])
        Wrong += 1
    else:
        Not += 1
if len(Test) < len(Ans[1]):
    Not += (len(Ans[1]) - len(Test))
if Mark < 0 :
    Mark = 0
print('{} {} {} {}'.format(Correct,Wrong,Not,Mark))


# 0673, 2022-02-17 08:14:25, PPx (67%)

x=input().split(',')
y=input()
point=0
c=0
f=0
z=0
m=x[0]
for i in range(len(x[0])):
    if m[i] in 'TF' and y[i] in 'TF':
        if m[i]==y[i]:
            point+=int(x[1])
            c+=1
        else:
            point-=int(x[2])
            f+=1
    else:
        z+=1
print(c,f,z,point)
# 0674, 2022-02-17 08:15:39, PPx (67%)

x=input().split(',')
y=input()
point=0
c=0
f=0
z=0
m=x[0]
for i in range(len(x[0])):
    if m[i] in 'TF' and y[i] in 'TF':
        if m[i]==y[i]:
            point+=int(x[1])
            c+=1
        else:
            point-=int(x[2])
            f+=1
    else:
        z+=1
if point<=0:
    point=0
print(c,f,z,point)
# 0675, 2022-02-17 08:16:21, PPx (67%)

x=input().split(',')
y=input()
point=0
c=0
f=0
z=0
m=x[0]
for i in range(len(x[0])):
    if m[i] in 'TF' and y[i] in 'TF':
        if m[i]==y[i]:
            point+=int(x[1])
            c+=1
        else:
            point-=int(x[2])
            f+=1
    else:
        z+=1
if point<=0:
    point=0
print(c,f,z,point)

# 0676, 2022-02-17 08:14:46, PPx (67%)

a, b, c = input().split(',')
d = input()

e = list(a)
f = list(d)
score = 0
corr = 0
wro = 0
no = 0
for i in range(len(a)):
    if f[i] == "-" or e[i] == "":
        no += 1
    if e[i] == f[i]:
        score += int(b)
        corr += 1
    elif e[i] != f[i] and (f[i] == "T" or f[i] == "F"):
        wro += 1
        score -= int(c)
        
print(corr, wro, no, score)
# 0677, 2022-02-17 08:15:22, PP- (67%)

a, b, c = input().split(',')
d = input()

e = list(a)
f = list(d)
score = 0
corr = 0
wro = 0
no = 0
for i in range(len(d)):
    if f[i] == "-" or e[i] == "":
        no += 1
    if e[i] == f[i]:
        score += int(b)
        corr += 1
    elif e[i] != f[i] and (f[i] == "T" or f[i] == "F"):
        wro += 1
        score -= int(c)
        
print(corr, wro, no, score)
# 0678, 2022-02-17 08:16:22, PP- (67%)

a, b, c = input().split(',')
d = input()

e = list(a)
f = list(d)
score = 0
corr = 0
wro = 0
no = 0
for i in range(len(d)):
    if f[i] == "-" or e[i] == "":
        no += 1
    if e[i] == f[i]:
        score += int(b)
        corr += 1
    elif e[i] != f[i] and (f[i] == "T" or f[i] == "F"):
        wro += 1
        score -= int(c)

no += len(a)-len(d)
print(corr, wro, no, score)

# 0679, 2022-02-17 08:14:37, --- (0%)

S = input().split(',')
s = str(S[0])
a = input()
a = a + ' '*(len(s)-len(a))
p = 0 ; c=0 ; w=0 ; n = 0

for i in range(len(s)) :
    if a[i] == s[i] :
        p+=int(S[1]) ; c+=1
    elif a[i] != s[i] and (a[i]==False or a[i]==True):
        p-=int(S[1]) ; w+=1
    else : n+=1
    
print(c,w,n,p)
    
        
# 0680, 2022-02-17 08:16:27, --- (0%)

S = input().split(',')
s = str(S[0])
a = input()
a = a + ' '*(len(s)-len(a))
p = 0 ; c=0 ; w=0 ; n = 0

for i in range(len(s)) :
    if a[i] == s[i] :
        p+=int(S[1]) ; c+=1
    elif a[i] != s[i] and (a[i]=='T' or a[i]=='F'):
        p-=int(S[1]) ; w+=1
    else : n+=1
    
print(c,w,n,p)
# 0681, 2022-02-17 08:17:30, PP- (67%)

S = input().split(',')
s = str(S[0])
a = input()
a = a + ' '*(len(s)-len(a))
p = 0 ; c=0 ; w=0 ; n = 0

for i in range(len(s)) :
    if a[i] == s[i] :
        p+=int(S[1]) ; c+=1
    elif a[i] != s[i] and (a[i]=='T' or a[i]=='F'):
        p-=int(S[2]) ; w+=1
    else : n+=1
    
print(c,w,n,p)

# 0682, 2022-02-17 08:12:59, PPx (67%)

a=input().split(",")
b=a[0]
w=a[1]
l=a[2]
c=input()
d=0
e=0
p=0
f=0
for i in range(len(b)):
    if b[i]==c[i]:
        d+=1
        p=p+int(w)
    elif c[i]=="-":
        f+=1
    else:
        e+=1
        p=p-int(l)
print(d,e,f,p)


# 0683, 2022-02-17 08:14:44, --x (0%)

a=input().split(",")
b=a[0]
w=a[1]
l=a[2]
c=input()
d=0
e=0
p=0
f=0
for i in range(len(b)):
    if b[i]==c[i]:
        d+=1
        p=p+int(w)
    else:
        e+=1
        p=p-int(l)
        
print(d,e,len(b[0])-len(c),p)


# 0684, 2022-02-17 08:15:18, P-x (33%)

a=input().split(",")
b=a[0]
w=a[1]
l=a[2]
c=input()
d=0
e=0
p=0
f=0
for i in range(len(b)):
    if b[i]==c[i]:
        d+=1
        p=p+int(w)
    else:
        e+=1
        p=p-int(l)
        
print(d,e,f,p)



# 0685, 2022-02-17 08:12:51, PP- (67%)

corr, crtpoints, wrgpoints = input().split(',')
answer = input()

crtpoints = int(crtpoints)
wrgpoints = int(wrgpoints)
points = 0
crt = 0
wrg = 0
none = 0
if len(answer) < len(corr):
    none = len(corr) - len(answer)
else:
    none = 0
    for i in range(len(answer)):
            if answer[i] != corr[i] and answer[i] != '-' :
                points -= wrgpoints
                wrg += 1
            elif answer[i] == corr[i]:
                points += crtpoints
                crt += 1
            elif answer[i] == '-':
                none += 1
            
print(crt,wrg,none,points)

# 0686, 2022-02-17 08:13:55, PP- (67%)

corr, crtpoints, wrgpoints = input().split(',')
answer = input()

crtpoints = int(crtpoints)
wrgpoints = int(wrgpoints)
points = 0
crt = 0
wrg = 0
none = 0
if len(answer) < len(corr):
    none = len(corr) - len(answer)
else:
    none = 0
    for i in range(len(answer)):
            if answer[i] != corr[i] and answer[i] != '-' :
                points -= wrgpoints
                wrg += 1
            elif answer[i] == corr[i]:
                points += crtpoints
                crt += 1
            elif answer[i] == '-':
                none += 1
if points < 0:
    points = 0
            
print(crt,wrg,none,points)

# 0687, 2022-02-17 08:15:38, PP- (67%)

corr, crtpoints, wrgpoints = input().split(',')
answer = input()

crtpoints = int(crtpoints)
wrgpoints = int(wrgpoints)
points = 0
crt = 0
wrg = 0
none = 0
if len(answer) < len(corr):
    none = len(corr) - len(answer)
elif len(answer) == len(corr):
    none = 0
    for i in range(len(answer)):
            if answer[i] != corr[i] and answer[i] != '-' :
                points -= wrgpoints
                wrg += 1
            elif answer[i] == corr[i]:
                points += crtpoints
                crt += 1
            elif answer[i] == '-':
                none += 1
                
if points < 0:
    points = 0
            
print(crt,wrg,none,points)


# 0688, 2022-02-17 08:07:20, --x (0%)

key = input().split(',')
k = key[0]
ans = input()
p = 0
s = 0
for i in range(len(k)):
    if ans[i] == k[i]:
        p +=1
s = p*int(key[1])-p*int(key[2])
if s<= 0:
    s = 0
print(s)
# 0689, 2022-02-17 08:13:37, PPx (67%)

key = input().split(',')
k = key[0]
ans = input()
p = 0
s = 0
f = 0
m = 0
for i in range(len(k)):
    if ans[i] == k[i]:
        p +=1
    elif ans[i] == '-':
        m += 1
    else:
        f +=1
s = p*int(key[1]) - (f)*int(key[2])
if s<= 0:
    s = 0
print(p,f,m,s)
# 0690, 2022-02-17 08:16:57, PPx (67%)

key = input().split(',')
k = key[0]
ans = input()
p = 0
s = 0
f = 0
m = 0
for i in range(len(k)):
    if ans[i] == k[i]:
        p +=1
    elif ans[i] == '-' or ans[i] == ' ':
        m += 1
    else:
        f +=1
s = p*int(key[1]) - (f)*int(key[2])
if s<= 0:
    s = 0
print(p,f,m,s)

# 0691, 2022-02-17 08:11:28, PP- (67%)

sol,n,m = input().split(",")
ans = input()
ans = ans+(" "*(len(sol)-len(ans)))
t = 0
f = 0
s = 0
score = 0
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += int(n)
        t += 1
    elif ans[i] in [" ","-"]:
        s += 1
    else:
        score -= int(m)
        f += 1
print(t,f,s,score)
# 0692, 2022-02-17 08:14:49, PP- (67%)

sol,n,m = input().split(",")
ans = input()
ans = ans+(" "*(len(sol)-len(ans)))
t = 0
f = 0
s = 0
score = 0
for i in range(len(sol)):
    if sol[i] == ans[i]:
        score += int(n)
        t += 1
    elif ans[i] in [" ","-"]:
        s += 1
        score += 0
    else:
        score -= int(m)
        f += 1
print(t,f,s,score)
# 0693, 2022-02-17 08:15:38, PP- (67%)

sol,n,m = input().split(",")
ans = input()
ans = ans+(" "*(len(sol)-len(ans)))
t = 0
f = 0
s = 0
score = 0
for i in range(len(ans)):
    if sol[i] == ans[i]:
        score += int(n)
        t += 1
    elif ans[i] in [" ","-"]:
        s += 1
        score += 0
    else:
        score -= int(m)
        f += 1
print(t,f,s,score)

# 0694, 2022-02-17 08:12:42, PPx (67%)

a,b,c=[i for i in input().split(',')]
key=list(input())
a=list(a)
count=0
count1=0
y=0
for i in range(len(a)):
    if key[i]==' ' or key[i] == '-':
        y+=1
    if a[i]==key[i]:
        count+=1
    if a[i]!=key[i] and key[i] != '-' and key[i]!=' ':
        count1+=1
b=int(b)
c=int(c)
correct=count
wrong=count1
print(count,wrong,y,count*b-count1*c)

# 0695, 2022-02-17 08:15:24, PPx (67%)

a,b,c=[i for i in input().split(',')]
key=list(input())
a=list(a)
count=0
count1=0
y=0
if len(key) < 5 :
    key=key+[' ']*(5-len(key))
for i in range(len(a)):
    if key[i]==' ' or key[i] == '-':
        y+=1
    if a[i]==key[i]:
        count+=1
    if a[i]!=key[i] and key[i] != '-' and key[i]!=' ':
        count1+=1
b=int(b)
c=int(c)
correct=count
wrong=count1
print(count,wrong,y,count*b-count1*c)

# 0696, 2022-02-17 08:16:27, PP- (67%)

a,b,c=[i for i in input().split(',')]
key=list(input())
a=list(a)
count=0
count1=0
y=0
if len(key) < len(a) :
    key=key+[' ']*(len(a)-len(key))
for i in range(len(a)):
    if key[i]==' ' or key[i] == '-':
        y+=1
    if a[i]==key[i]:
        count+=1
    if a[i]!=key[i] and key[i] != '-' and key[i]!=' ':
        count1+=1
b=int(b)
c=int(c)
correct=count
wrong=count1
print(count,wrong,y,count*b-count1*c)


# 0697, 2022-02-17 08:10:01, P-x (33%)

keys = input().split(",")
ans = str(input())
key = keys[0]
right = int(keys[1])
wrong = int(keys[2])

c=-1

x=0
y=0
z=0
score=0

for k in key:
    c +=1
    if k == ans[c]:
        score += right
        x+=1
    elif k == '-':
        score += 0
        z+=1
    else:
        score -= wrong
        y+=1
        
print(x,y,z,score)


# 0698, 2022-02-17 08:13:07, xxx (0%)

keys = input().split(",")
ans = str(input())
key = keys[0]
right = int(keys[1])
wrong = int(keys[2])

wrongkey=key
cc==0
for i in key.split():
    if i =='T':
        wrongkey[cc]=F
    else:
        wrongkey[cc]=T
    cc+=1
        
        

c=-1

x=0
y=0
z=0
score=0



for k in key:
    c +=1
    if k == key[c]:
        score += right
        x+=1
    elif k == '-':
        score += 0
        z+=1
    else:
        score -= wrong
        y+=1
        
print(x,y,z,score)


# 0699, 2022-02-17 08:15:01, PP- (67%)

keys = input().split(",")
ans = str(input())
key = keys[0]
right = int(keys[1])
wrong = int(keys[2])

# wrongkey=key
# cc==0
# for i in key.split():
#     if i =='T':
#         wrongkey[cc]=F
#     else:
#         wrongkey[cc]=T
#     cc+=1
        
        

c=-1

x=0
y=0
z=0
score=0



for k in ans:
    c +=1
    if k == key[c]:
        score += right
        x+=1
    elif k == '-':
        score += 0
        z+=1
    else:
        score -= wrong
        y+=1
        
print(x,y,z,score)



# 0700, 2022-02-17 08:15:33, xxx (0%)

a,b,c = input().split(',')
p = input()
x,y,z,p = 0,0,0,0
for i in range(len(a)):
  if i < len(p) :
    if a[i] == p[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      p +=1
    else:
      x -= int(c)
      z += 1
  else:
    p += 1
  if x < 0:
    x = 0
print(y,z,p,x)
# 0701, 2022-02-17 08:16:14, xxx (0%)

a,b,c = input().split(',')
p = input()
x,y,z,d = 0,0,0,0
for i in range(len(a)):
  if i < len(d) :
    if a[i] == p[i] :
      x += int(b)
      y += 1
    elif d[i] == '-':
      d +=1
    else:
      x -= int(c)
      z += 1
  else:
    d += 1
  if x < 0:
    x = 0
print(y,z,d,x)
# 0702, 2022-02-17 08:17:22, PP- (67%)

n0,n1,n2=input().split(',')
y=input()
k=0
miss=0
p=0
n=0

for i in range(len(n0)):
    if len(y) != len(n0):
        y += 'P'
        miss+=1
    if y[i]=='-':
        miss+=1
        n-=1
for i in range(len(n0)):
    if y[i]==n0[i]:
        k+=int(n1)
        p+=1
    elif y[i]=='-' or y[i]=='P':
        n+=1
    else:
        k -= int(n2)
        n += 1
if k<0:
    k=0
print(p,n,miss,k)

# 0703, 2022-02-17 08:15:08, PPx (67%)

key,pp,mm = input().split(',')
a = input()
pp,mm = int(pp),int(mm)
cr = 0
cw = 0
cn = 0
non = 0
for i in range(len(key)):
    if len(key)-len(a) > 0:
        cn = len(key)-len(a)
        
    if a[i] == key[i]:
        cr +=1
    elif a[i]== '-':
        cn +=1
        continue
    elif a[i] != key[i]:
        cw +=1
    
su = (cr*pp) - (cw*mm)
if su <= 0 :
    su = 0
print(cr, cw, cn, su)

# 0704, 2022-02-17 08:16:26, PPx (67%)

key,pp,mm = input().split(',')
a = input()
pp,mm = int(pp),int(mm)
cr = 0
cw = 0
cn = 0
non = 0
for i in range(len(key)):
    if len(key)-len(a) > 0:
        cn = len(key)-len(a)
        
    if a[i] == key[i]:
        cr +=1
    elif a[i]== '-':
        cn +=1
        continue
    elif a[i] != key[i]:
        cw +=1
    
su = (cr*pp) - (cw*mm)
if su <= 0 :
    su = 0
print(cr,cw,cn,su)
# 0705, 2022-02-17 08:17:00, PPx (67%)

key,pp,mm = input().split(',')
a = input()
pp,mm = int(pp),int(mm)
cr = 0
cw = 0
cn = len(key)-len(a)

for i in range(len(key)):
        
    if a[i] == key[i]:
        cr +=1
    elif a[i]== '-':
        cn +=1
        continue
    elif a[i] != key[i]:
        cw +=1
    
su = (cr*pp) - (cw*mm)
if su <= 0 :
    su = 0
print(cr,cw,cn,su)

# 0706, 2022-02-17 08:14:37, xxx (0%)

a=input()
a=a.split(',')
x=a[0]
b=input()
score=0
trues=0
falses=0
non=0
for i in range(x):
    if x[i]==b[i]:
        trues+=1
        score += int(a[1])
    elif b[i] == '-':
        non+=1
        continue
    else:
        falses+=1 
        score -= int(a[2])
print(trues,falses,non,score)
# 0707, 2022-02-17 08:14:42, xxx (0%)

a=input()
a=a.split(',')
x=a[0]
b=input()
score=0
trues=0
falses=0
non=0
for i in range(x):
    if x[i]==b[i]:
        trues+=1
        score += int(a[1])
    elif b[i] == '-':
        non+=1
        continue
    else:
        falses+=1 
        score -= int(a[2])
print(trues,falses,non,score)
# 0708, 2022-02-17 08:15:59, PPx (67%)

a=input()
a=a.split(',')
x=a[0]
b=input()
score=0
trues=0
falses=0
non=0
for i in range (len(x)):
    if x[i]==b[i]:
        trues+=1
        score += int(a[1])
    elif b[i] == '-':
        non+=1
        continue
    else:
        falses+=1 
        score -= int(a[2])
print(trues,falses,non,score)

# 0709, 2022-02-17 08:11:55, PP- (67%)

n1=input().split(",")
n2=input()
c=0;c1=0
a=0;a1=0
n11=n1[0]
for i in range(len(n2)):
    if n2[i]==n11[i] and "A"<=n2[i]<="Z":
        c+=int(n1[-2])
        c1+=1
    elif n2[i]!=n11[i] and "A"<=n2[i]<="Z":
        c-=int(n1[-1])
        a1+=1
    elif n2[i]=="-":
        a+=1
b=len(n1)-len(n2)
print(c1,a1,a,c)
# 0710, 2022-02-17 08:16:39, PP- (67%)

n1=input().split(",")
n2=input()
c=0;c1=0
a=0;a1=0
n11=n1[0]
for i in range(len(n2)):
    if n2[i]==n11[i] and "A"<=n2[i]<="Z":
        c+=int(n1[-2])
        c1+=1
    elif n2[i]!=n11[i] and "A"<=n2[i]<="Z":
        c-=int(n1[-1])
        a1+=1
    elif n2[i]=="-":
        a+=1
if len(n11)!=len(n2):
    a+=len(n11)-len(n2)
b=len(n1)-len(n2)
print(c1,a1,a,c)
# 0711, 2022-02-17 08:17:19, PP- (67%)

n1=input().split(",")
n2=input()
c=0;c1=0
a=0;a1=0
n11=n1[0]
for i in range(len(n2)):
    if n2[i]==n11[i] and "A"<=n2[i]<="Z":
        c+=int(n1[-2])
        c1+=1
    elif n2[i]!=n11[i] and "A"<=n2[i]<="Z":
        c-=int(n1[-1])
        a1+=1
    elif n2[i]=="-":
        a+=1
if len(n11)!=len(n2):
    a+=len(n11)-len(n2)
b=len(n1)-len(n2)
print(c1,a1,a,c)

# 0712, 2022-02-17 08:11:57, PPx (67%)

A,T_S,F_s = [str(e) for e in input().split(",")]
pe = str(input())
i = 0
No_sc = 0
sc = 0
while i < len(A):
    if pe[i] == A[i]:
        sc +=1
    elif pe[i] == "-":
        No_sc += 1
    i += 1
sc_T = sc*int(T_S)
FF = len(A)-int(sc)-No_sc
sc_F = FF*int(F_s)
sc_to = sc_T-sc_F
print(sc,FF,No_sc,sc_to)

# 0713, 2022-02-17 08:16:36, PP- (67%)

A,T_S,F_s = [str(e) for e in input().split(",")]
pe = str(input())
i = 0
No_sc = 0
FF = 0
sc = 0
while i < len(pe):
    if pe[i] == A[i]:
        sc +=1
    elif pe[i] == "-":
        No_sc += 1
    elif pe[i] == "T" or pe[i] == "F":
        FF +=1
    else:
        No_sc += 1
    i += 1
p = len(A)-len(pe)
No_sc += p
sc_T = sc*int(T_S)
sc_F = FF*int(F_s)
sc_to = sc_T-sc_F
print(sc,FF,No_sc,sc_to)

# 0714, 2022-02-17 08:17:18, --- (0%)

A,T_S,F_s = [str(e) for e in input().split(",")]
pe = str(input())
i = 0
No_sc = 0
FF = 0
sc = 0
while i < len(pe)-1:
    if pe[i] == A[i]:
        sc +=1
    elif pe[i] == "-":
        No_sc += 1
    elif pe[i] == "T" or pe[i] == "F":
        FF +=1
    else:
        No_sc += 1
    i += 1
p = len(A)-len(pe)
No_sc += p
sc_T = sc*int(T_S)
sc_F = FF*int(F_s)
sc_to = sc_T-sc_F
print(sc,FF,No_sc,sc_to)

# 0715, 2022-02-17 08:12:38, PP- (67%)

ans,p,m = [str(e) for e in input().split(',')]
n = str(input())
xtrue = 0
xfalse = 0
nd = 0
score = 0
for i in range (len(n)) :
    if n[i] == ans[i] :
        xtrue += 1
        score += int(p)
    elif n[i] == '-' :
        nd += 1
    else :
        score -= int(m)
        xfalse += 1
print(xtrue,xfalse,nd,score)
# 0716, 2022-02-17 08:14:07, PP- (67%)

ans,p,m = [str(e) for e in input().split(',')]
n = str(input())
xtrue = 0
xfalse = 0
nd = 0
score = 0
for i in range (len(n)) :
    if n[i] == ans[i] :
        xtrue += 1
        score += int(p)
    elif n[i] == '-' :
        nd += 1
    else :
        score -= int(m)
        xfalse += 1
nd += len(ans)-len(n)
print(xtrue,xfalse,nd,score)

# 0717, 2022-02-17 08:15:38, PP- (67%)

ans,p,m = [str(e) for e in input().split(',')]
n = str(input())
xtrue = 0
xfalse = 0
nd = 0
score = 0
for i in range (len(n)) :
    if n[i] == ans[i] :
        xtrue += 1
        score += int(p)
    elif n[i] == '-' :
        nd += 1
    else :
        score -= int(m)
        xfalse += 1
if score < 0 :
    score = 0
print(xtrue,xfalse,nd,score)

# 0718, 2022-02-17 08:08:23, PP- (67%)

Ans = input().split(',')
AnsT = Ans[0]
plus = int(Ans[1])
minus = int(Ans[2])

Quiz = input()
c = 0
right = 0
wrong = 0
notdo = 0

for i in range(len(Quiz)):
    if Quiz[i] == AnsT[i]:
        c += plus
        right += 1
    elif Quiz[i] == '-':
        c += 0
        notdo += 1
    else :
        c -= minus
        wrong += 1
        
print (right,wrong,notdo,c)
        
# 0719, 2022-02-17 08:12:45, --- (0%)

Ans = input().split(',')
AnsT = Ans[0]
plus = int(Ans[1])
minus = int(Ans[2])

Quiz = input()
c = 0
right = 0
wrong = 0
notdo = 0

for i in range(len(Quiz)):
    if Quiz[i] == AnsT[i]:
        c += plus
        right += 1
    elif Quiz[i] == '-':
        c += 0
        notdo += 1
    else :
        c -= minus
        wrong += 1
notdo += abs(len(Ans)-len(Quiz))
print (right,wrong,notdo,c)
# 0720, 2022-02-17 08:15:21, PP- (67%)

Ans = input().split(',')
AnsT = Ans[0]
plus = int(Ans[1])
minus = int(Ans[2])

Quiz = input()
c = 0
right = 0
wrong = 0
notdo = 0

for i in range(len(Quiz)):
    if Quiz[i] == AnsT[i]:
        c += plus
        right += 1
    elif Quiz[i] == '-':
        c += 0
        notdo += 1
    else :
        c -= minus
        wrong += 1
if len(Quiz) != len(Ans):
    if len(Ans) > len(Quiz):
        notdo += len(Ans)-len(Quiz)
print (right,wrong,notdo,c)

# 0721, 2022-02-17 08:14:02, --- (0%)

a,b,c = [e for e in input().split(',')]
d = input
t = 0
f = 0
n = 0
if len(a) != len(b):
    b += ' '*len(a)
for i in range(len(a)):
    if a[i] == b[i] and a[i] == T:
        t += 1
    elif a[i] == b[i] and a[i] == f:
        f += 1
    else:
        n += 1
    
print(str(t)+' ' + str(f) + ' ' + str(n) + ' ' + str(t-f))
# 0722, 2022-02-17 08:14:40, PP- (67%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if len(ans) != len(check) : 
    d += len(ans) - len(check)
  if len(ans) == len(check):
    if ans[i] == check[i] :
      score += cor
      c += 1
    elif ans[i] != check[i] :
      if check[i] == '-':
        d += 1
      else:
        w += 1
        score -= wro
print(c, w, d, score)

# 0723, 2022-02-17 08:13:18, P-x (33%)

ans,plus,minus=input().split(',')
mine=input()
cor=0
wrong=0
maidai=0
for i in range(len(ans)):
    if ans[i]==mine[i]:
        cor+=1
    elif mine[i]=='-':
        maidai+=1
    else:
        wrong+=1
p=cor*int(plus)
m=wrong*int(minus)
z=p+m
print(cor,wrong,maidai,z)
# 0724, 2022-02-17 08:16:29, PPx (67%)

ans,plus,minus=input().split(',')
mine=input()
cor=0
wrong=0
maidai=0
for i in range(len(ans)):
    if ans[i]==mine[i]:
        cor+=1
    elif mine[i]=='-':
        maidai+=1
    else:
        wrong+=1
p=cor*int(plus)
m=wrong*int(minus)
z=p-m
print(cor,wrong,maidai,z)

# 0725, 2022-02-17 08:13:49, PPx (67%)

ans,plus,minus = input().split(',')
student = input()
right = 0 ; no_ans = 0 ; wrong = 0
for i in range(len(ans)):
    if student[i] == ans[i] :
        right += 1
    if student[i] != ans[i] :
        if student[i] == '-':
            no_ans += 1
        else :
            wrong += 1
score = (int(plus)*right) - (int(minus)*wrong)
print(str(right) ,str(wrong) ,str(no_ans), score)
# 0726, 2022-02-17 08:15:58, PP- (67%)

ans,plus,minus = input().split(',')
student = input()
right = 0 ; no_ans = 0 ; wrong = 0
for i in range(len(student)):
    if student[i] == ans[i] :
        right += 1
    if student[i] != ans[i] :
        if student[i] == '-':
            no_ans += 1
        else :
            wrong += 1
score = (int(plus)*right) - (int(minus)*wrong)
if score < 0:
 score = 0
print(str(right) ,str(wrong) ,str(no_ans), score)

# 0727, 2022-02-17 08:09:23, PPx (67%)

Answer,plus,minus=input().split(',')
plus=int(plus)
minus=int(minus)
sum=0
correct=0
wrong=0
noans=0
myans=input()
for i in range(len(Answer)):
    if myans[i]=='-':
        noans+=1
    elif Answer[i]==myans[i]:
        sum+=plus
        correct+=1
    else:
        sum-=minus
        wrong+=1
print(correct,wrong,noans,sum)

# 0728, 2022-02-17 08:15:10, PP- (67%)

Answer,plus,minus=input().split(',')
plus=int(plus)
minus=int(minus)
sum=0
correct=0
wrong=0
noans=0
myans=input()
for i in range(len(myans)):
    if i >len(myans):
        noans+=1
        break
        
    if myans[i]=='-':
        noans+=1
    elif Answer[i]==myans[i]:
        sum+=plus
        correct+=1
    else:
        sum-=minus
        wrong+=1
    
    if sum<0:
        sum=0
print(correct,wrong,noans,sum)


# 0729, 2022-02-17 08:15:25, P-x (33%)

x1 = input().split(",")
x2 = input()
if len(x2) != len(x1) :
    x2 += "0"*(len(x1)-len(x2))
b = x1[0]
score = 0
correct = 0
wrong = 0
none = 0
for i in range(len(b)) :
    if b[i] == 0 or b[i] == "-" :
        none +=1
    elif b[i] == x2[i] :
        score += int(x1[1])
        correct += 1
    elif b[i] != x2[i] :
        score -= int(x1[2])
        wrong +=1
print(correct,wrong,none,score)
# 0730, 2022-02-17 08:17:12, PPx (67%)

x1 = input().split(",")
x2 = input()
if len(x2) != len(x1) :
    x2 += "0"*(len(x1)-len(x2))
b = x1[0]
score = 0
correct = 0
wrong = 0
none = 0
for i in range(len(b)) :
    if b[i] == 0 or x2[i] == "-" :
        none +=1
    elif b[i] == x2[i] :
        score += int(x1[1])
        correct += 1
    elif b[i] != x2[i] :
        score -= int(x1[2])
        wrong +=1
print(correct,wrong,none,score)

# 0731, 2022-02-17 08:11:10, PP- (67%)

a,b,c=input().split(',')
x=input()

t=0
f=0
m=0
p=0
for i in range(len(x)):
    if a[i]==x[i] and x[i]!='-':
        p+=int(b)
        t+=1
    elif a[i]!=x[i] and x[i]!='-':
        p-=int(c)
        f+=1
    elif x[i]=='-':
        p+=0
        m+=1
print(str(t),str(f),str(m),str(p))
# 0732, 2022-02-17 08:13:53, PP- (67%)

a,b,c=input().split(',')
x=input()

t=0
f=0
m=0
p=0
for i in range(len(x)):
    if a[i]==x[i] and x[i]!='-':
        p+=int(b)
        t+=1
    elif a[i]!=x[i] and x[i]!='-':
        p-=int(c)
        f+=1
    elif x[i]=='-':
        p+=0
        m+=1
    else:
        p+=0
        m+=1

        
print(str(t),str(f),str(m),str(p))
        

# 0733, 2022-02-17 08:14:27, compilation error (0%)

x,y,z = input().split(",")
key = input()
c = 0
f = 0
b = 0
    for i in range (len(x)):
        if x[i] == key[i]:
        c+=1
        else:
            if key[i] =="T" or key[i] =="F":
            f+=1
            else:
            b+=1
print(c,f,b,c*int(y)-f*int(z))
# 0734, 2022-02-17 08:14:46, PPx (67%)

x,y,z = input().split(",")
key = input()
c = 0
f = 0
b = 0
for i in range (len(x)):
    if x[i] == key[i]:
        c+=1
    else:
        if key[i] =="T" or key[i] =="F":
            f+=1
        else:
            b+=1
print(c,f,b,c*int(y)-f*int(z))

# 0735, 2022-02-17 08:15:01, --- (0%)

check = input().split(',')
tru = check[0]
ans = input()
cr = 0
wr = 0
ndo = 0
point = 0
if len(ans) < len(tru):
    ans = ans + '-' * (len(tru) - len(ans))
for i in range (len(check)):
    if ans[i] == tru[i]:
        cr += 1
        point += int(check[1])
    elif ans[i] != tru[i] and ans[i] != '-':
        wr += 1
        point = point - int(check[2])
    elif ans[i] == '-':
        ndo += 1
print(cr, wr, ndo, point)    
# 0736, 2022-02-17 08:16:28, PP- (67%)

check = input().split(',')
tru = check[0]
ans = input()
cr = 0
wr = 0
ndo = 0
point = 0
if len(ans) < len(tru):
    ans = ans + '-' * (len(tru) - len(ans))
for i in range (len(tru)):
    if ans[i] == tru[i]:
        cr += 1
        point += int(check[1])
    elif ans[i] != tru[i] and ans[i] != '-':
        wr += 1
        point = point - int(check[2])
    elif ans[i] == '-':
        ndo += 1
print(cr, wr, ndo, point) 

# 0737, 2022-02-17 08:15:26, PPx (67%)

a = input().split(',')
b = input()
ans = a[0]
plus = a[1]
minus = a[2] 
n = 0
notdo = 0
ncorrrect = 0
nwrong = 0
point = 0
while n < len(ans):
  if b[n] == ans[n]:
    point += int(plus)
    ncorrrect += 1
  if b[n] == '-':
    notdo += 1
  if b[n] == 'T' and ans[n] == 'F':
    point -= int(minus)
    nwrong += 1
  if b[n] == 'F' and ans[n] == 'T':
    point -= int(minus)
    nwrong += 1
  n +=1
print(str(ncorrrect)+ ' '+str(nwrong)+' ' + str(notdo) + ' ' + str(point) )
# 0738, 2022-02-17 08:17:12, PPx (67%)

a = input().split(',')
b = input()
ans = a[0]
plus = a[1]
minus = a[2] 
n = 0
notdo = 0
ncorrrect = 0
nwrong = 0
point = 0
if len(b) < len(a):
  b += '-'*(len(b)-len(a))
while n < len(ans):
  if b[n] == ans[n]:
    point += int(plus)
    ncorrrect += 1
  if b[n] == '-':
    notdo += 1
  if b[n] == 'T' and ans[n] == 'F':
    point -= int(minus)
    nwrong += 1
  if b[n] == 'F' and ans[n] == 'T':
    point -= int(minus)
    nwrong += 1
  n +=1
print(str(ncorrrect)+ ' '+str(nwrong)+' ' + str(notdo) + ' ' + str(point) )

# 0739, 2022-02-17 08:13:20, --- (0%)

x = input()
y = input()
if len(x) == len(y) :
    y = 0
    n = 0
    o = 0
    
    for i in range(len(y)):
        if x[i] == y[i] : 
          y += 1
          
        else : 
          if x[i] == '-':
           o += 1
           
          else:
            n += 1



    print(y, n, o, (y-n) )

# 0740, 2022-02-17 08:14:16, PP- (67%)

ans, cor, wro = input().split(',')
cor = int(cor)
wro = int(wro)
check = input()
score = 0
c = 0
w = 0
d = 0
for i in range(len(ans)) :
  if len(ans) != len(check) : 
    d += len(ans) - len(check)
  if len(ans) == len(check):
    if ans[i] == check[i] :
      score += cor
      c += 1
    elif ans[i] != check[i] :
      if check[i] == '-':
        d += 1
      else:
        w += 1
        score -= wro
print(c, w, d, score)

# 0741, 2022-02-17 08:07:18, P-x (33%)

y = input().split(',')
answer = input()

correct = str(y[0])
t = 0
score = 0
h = 0
f = 0
n = 0
for i in range(len(correct)):
    if correct[i] == answer[i]:
        score += int(y[1])
        t += 1
    else:
        if correct[i] != answer[i]:
            h -= int(y[2])
            f += 1
        if answer[i] == '-':
            n += 1
print(t, f, n, score)

# 0742, 2022-02-17 08:13:43, PPx (67%)

y = input().split(',')
answer = input()

correct = str(y[0])
t = 0
s = 0
h = 0
f = 0
n = 0
for i in range(len(correct)):
    if correct[i] == answer[i]:
        s += int(y[1])
        t += 1
    else:
        if answer[i] == '-':
            n += 1
        else:
            h -= int(y[2])
            f += 1
score = h + s
print(t, f, n, score)



# 0743, 2022-02-17 08:10:15, PPx (67%)

first_input = input().split(',')
trueans = first_input[0]
score_per = int(first_input[1])
score_del = int(first_input[2])
doans = input()
corect = 0
falsee = 0
nonedo = 0
score = 0
for i in range(0,len(trueans)):
    if doans[i] == trueans[i]:
        score += score_per
        corect +=1
    if doans[i] != trueans[i] and doans[i] != '-' :
        score -= score_del
        falsee += 1
    if doans[i] == '-':
        nonedo += 1
print( corect , falsee, nonedo,score)
        
# 0744, 2022-02-17 08:14:23, PP- (67%)

first_input = input().split(',')
trueans = first_input[0]
score_per = int(first_input[1])
score_del = int(first_input[2])
doans = input()
corect = 0
falsee = 0
nonedo = 0
score = 0
doans += (len(trueans)-len(doans))*'-'
for i in range(0,len(trueans)):
    if doans[i] == trueans[i]:
        score += score_per
        corect +=1
    if doans[i] != trueans[i] and doans[i] != '-' :
        score -= score_del
        falsee += 1
    if doans[i] == '-' :
        nonedo += 1 
print( corect , falsee, nonedo,score)

# 0745, 2022-02-17 08:14:36, PPx (67%)

sol = input().split(',')
ans = input()

solu = sol[0]
score = 0
right = 0
wrong = 0
nodone = 0

for i in range(len(ans)):
  if ans[i] == '-':
    nodone += 1  
    
for i in range(len(solu)):
  if ans[i] == solu[i]:
    score += int(sol[1])
    right += 1
  elif ans[i] != '-' and ans[i] != solu[i]:
    score -= int(sol[2])
    wrong += 1
  
print(right, wrong, nodone, score)
 
# 0746, 2022-02-17 08:16:15, PPx (67%)

sol = input().split(',')
ans = input()

solu = sol[0]
score = 0
right = 0
wrong = 0
nodone = 0
for i in range(len(ans)):
  if ans[i] == '-':
    nodone += 1  
if len(ans) != len(solu):
  ans = ans[0:] + '-'*(len(ans) - len(solu))
for i in range(len(solu)):
  if ans[i] == solu[i]:
    score += int(sol[1])
    right += 1
  elif ans[i] != '-' and ans[i] != solu[i]:
    score -= int(sol[2])
    wrong += 1
  
print(right, wrong, nodone, score)

# 0747, 2022-02-17 08:15:25, PPx (67%)

data = input().split(',')
answer = data[0]
add = data[1]
deduc = data[2]
guess = input()
correct = 0
wrong = 0
no_guess = 0
points = 0

for i in range(len(answer)):
    if guess[i] == answer[i]:
        points += int(add)
        correct += 1
    elif guess[i] == '-' or guess[i] == ' ':
        no_guess += 1   
    elif guess[i] != answer[i]:
        points -= int(deduc)
        wrong += 1
        
print(correct, wrong, no_guess, points)   

# 0748, 2022-02-17 08:16:42, PPx (67%)

data = input().split(',')
answer = data[0]
add = data[1]
deduc = data[2]
guess = input()
correct = 0
wrong = 0
no_guess = 0
points = 0

for i in range(len(answer)):
    if guess[i] == answer[i]:
        points += int(add)
        correct += 1
    elif guess[i] == '-' or guess[i] == ' ':
        no_guess += 1   
    elif guess[i] != answer[i]:
        points -= int(deduc)
        wrong += 1
if points < 0:
    points = 0
        
print(correct, wrong, no_guess, points)  


# 0749, 2022-02-17 08:08:42, P-x (33%)

x=input().split(',')
y=input()
z=x[0]
a=0
b=0
c=0
d=0
for i in range(len(z)):
    if z[i]==y[i]:
        a+=1
        d+=int(x[1])
    elif y[i]=='-':
        c+=1
    else:
        b+=1
print(a,b,c,d)
# 0750, 2022-02-17 08:12:35, PPx (67%)

x=input().split(',')
y=input()
z=x[0]
a=0
b=0
c=0
d=0
for i in range(len(z)):
    if z[i]==y[i]:
        a+=1
        d+=int(x[1])
    elif y[i]=='-':
        c+=1
    elif z[i] != y[i]:
        d-=int(x[2])
        b+=1
print(a,b,c,d)

# 0751, 2022-02-17 08:11:24, PPx (67%)

X,pt,pf = input().split(",")
Y = input()
a=0
b=0
c=0
for i in range (len(X)) :
  if X[i] == Y[i] :
    a+=1
  elif Y[i] == "-":
    c+=1
  elif Y[i] == " ":
    c+=1
  else :
    b+=1
print (a,b,c,a*int(pt)-b*int(pf))    
# 0752, 2022-02-17 08:14:40, PP- (67%)

X,pt,pf = input().split(",")
X = str(X)
Y = input()
Y = str(Y) + " "*(len(X)-len(Y))
a=0
b=0
c=0
for i in range (len(X)) :
  if X[i] == Y[i] :
    a+=1
  elif Y[i] == "-":
    c+=1
  elif Y[i] == " ":
    c+=1
  else :
    b+=1
print (a,b,c,a*int(pt)-b*int(pf))  

# 0753, 2022-02-17 08:12:07, -Px (33%)

n = input().split(',')
f = input()

o = n[0]

c = 0
correct = 0
wrong = 0
dont = 0

for i in range(len(o)):
    if f[i] == o[i]:
        c += int(n[1])
        correct += 1
    elif f[i] != o[i] and f[i] == '-':
        c += 0
        dont += 1
    else:
        c -= int(n[2])
        wrong += 1
if c < 0:
    c= 0
print(correct,dont,wrong,c)
    
# 0754, 2022-02-17 08:13:26, PPx (67%)

n = input().split(',')
f = input()

o = n[0]

c = 0
correct = 0
wrong = 0
dont = 0

for i in range(len(o)):
    if f[i] == o[i]:
        c += int(n[1])
        correct += 1
    elif f[i] != o[i] and f[i] == '-':
        c += 0
        dont += 1
    else:
        c -= int(n[2])
        wrong += 1
if c < 0:
    c= 0
print(correct,wrong,dont,c)

# 0755, 2022-02-17 08:08:44, P-x (33%)

x =input().split(",")
y =input()
a = 0
b = 0
c = 0
sum = 0
tr = int(x[1])
fa = int(x[2])
for i in range(len(x[0])):
    if(x[0][i] == "-"):
        c += 1
    elif(x[0][i] == y[i]):
        a += 1
        sum += tr
    else:
        b += 1
        sum -= fa
print(a, b, c, sum)
# 0756, 2022-02-17 08:10:55, PPx (67%)

x =input().split(",")
y =input()
a = 0
b = 0
c = 0
sum = 0
tr = int(x[1])
fa = int(x[2])
for i in range(len(x[0])):
    if(y[i] == "-"):
        c += 1
    elif(x[0][i] == y[i]):
        a += 1
        sum += tr
    else:
        b += 1
        sum -= fa
print(a, b, c, sum)

# 0757, 2022-02-17 08:12:11, P-- (33%)

key=input().split(',')
did=input()
ptpercor=int(key[1])
ptpernot=int(key[2])
nkey=key[0]
pt=0
cor=0
wrong=0
notdone=0
for i in range(len(did)):
    if did[i]==nkey[i]:
        pt=pt+ptpercor
        cor=cor+1
    elif did[i]!=nkey[i] and did[i]!=['-']:
        pt=pt-ptpernot
        wrong=wrong+1
    else:
        notdone=notdone+1
    i=i+1
notdone=notdone+len(nkey)-len(did)
print(cor, wrong, notdone, pt)
# 0758, 2022-02-17 08:15:56, PP- (67%)

key=input().split(',')
did=input()
ptpercor=int(key[1])
ptpernot=int(key[2])
nkey=key[0]
pt=0
cor=0
wrong=0
notdone=0
for i in range(len(did)):
    if did[i]==nkey[i]:
        pt=pt+ptpercor
        cor=cor+1
    elif did[i]!=nkey[i] and did[i]!='-':
        pt=pt-ptpernot
        wrong=wrong+1
    else:
        notdone=notdone+1
    i=i+1
notdone=notdone+len(nkey)-len(did)
print(cor, wrong, notdone, pt)

# 0759, 2022-02-17 08:13:45, PP- (67%)

s=input().split(",")
y=input()
a=s[0]
i=0
score=0
cor=0
m=0
fal=0

while i<len(y) :
    if a[i]==y[i] :
        score+=int(s[1])
        cor+=1
    elif y[i]=="-" :
        score=score+0
        m+=1
    else :
        score-=int(s[2])
        fal+=1
    i+=1

print(cor,fal,m,score)

# 0760, 2022-02-17 08:15:41, PP- (67%)

ans = input().split(',')
s = ans[0]
t = ans[1]
kt = 0
f = ans[2]
kf = 0
m = 0
q = input()
score = 0
for i in range(len(q)) :
    if q[i] == s[i] :
        score += int(t)
        kt += 1
    elif q[i] != s[i] and q[i] != '-' :
        score -= int(f)
        kf += 1
    if q[i] == '-' :
            m += 1

    if len(q) < len(s) :
        m += (len(s) - len(q))        

print(kt,kf,m,score)
 
        
        
        

# 0761, 2022-02-17 08:14:25, PP- (67%)

a=input().split(",")
tans=[a[0]]+[int(a[1])]+[int(a[2])]
ans=input()
cc=0
cn=0
cw=0
for i in range(len(ans)):
  if i+1 <= len(ans):
      if ans[i]==tans[0][i]:
          cc+=1
      elif ans[i]=="-":
        cn+=1
      else:
        cw+=1
  else:
    cn+=1
pt=(cc*tans[1])-(cw*tans[2])
if pt <0:
    pt=0
print(cc,cw,cn,pt)

# 0762, 2022-02-17 08:14:10, PP- (67%)

a = input().split(',')
a1 = a[0]
s = input() + '   '

c = 0
choice = 0
no1 = 0
wrong = 0
for i in range(len(a[0])):
    if s[i] == a1[i]:
        c += int(a[1])
        choice += 1
    elif s[i] == ' ' or s[i] == '-':
        c += 0
        no1 += 1
    elif s[i] =='T' and a1[i] == 'F':
        c -= int(a[2])
        wrong+= 1
    elif s[i] =='F' and a1[i] == 'T':
        c -= int(a[2])
        wrong+= 1   
print(choice, wrong, no1, c)

# 0763, 2022-02-17 08:12:44, PPx (67%)

kAns = input().split(',')
r_ans = kAns[0]
Ans = input()
t = 0
f = 0
j = 0
tf = ['T','F']

for i in range(len(r_ans)):
    if Ans[i] == r_ans[i]:
        t+=1
    if Ans[i] != r_ans[i]:
        if Ans[i] in  tf:
            f+=1
        else:
            j +=1
score = t*int(kAns[1])-f*int(kAns[2])
print(t,f,j,score)

        

# 0764, 2022-02-17 08:15:38, PP- (67%)

a,b,c = input().split(',')
d = input()
b = int(b[0])
c = int(c[0])
e = 0
f = 0
g = 0
if len(a) == len(d) :
    for i in range(len(a)):
        if d[i] != '-':
            if d[i] in a[i] :
                e = e+1
            else :
                g = g+1 
        if d[i] == '-':
            f =f+1
h = (e*b)-(g*c)-0*f
e =str(e)
g = str(g)
f=str(f)
h = str(h)
print(e+" " +g+' '+f+' '+h)

# 0765, 2022-02-17 08:12:56, P-P (67%)

key = input()
ans = input()
score = 0
list_key = key.split(',')
test = list_key[0]
cor = 0
wro = 0
non = 0

if len(ans) < len(test) :
    ans += ' ' * (len(test) - len(ans))

for e in range(len(test)) :
    if test[e] == ans[e] :
        score += int(list_key[1])
        cor += 1
    elif ans[e] == '-' or ans[e] == ' ' :
        if score - int(list_key[2]) >= 0 :
            score -= int(list_key[2])
        non += 1
    else :
        wro += 1
        if score - int(list_key[2]) >= 0 :
            score -= int(list_key[2])

print(cor, wro, non, score)


# 0766, 2022-02-17 08:13:39, PP- (67%)

q=input()
a=input()
k=0
k2=0
k3=0
s=''
for i in range(len(a)):
    if a[i]==q[i]:
        k+=1
    elif (a[i]=='T' and q[i]=='F') or (a[i]=='F' and q[i]=='T'):
        k2+=1
    elif a[i]=='-':
        k3+=1
for ch in q:
    if '0'<=ch<='9':
        s+=ch
p=(int(s[0])*k)-(int(s[1])*k2)        
print(k,k2,k3,p)        

# 0767, 2022-02-17 08:12:31, PPx (67%)

a = input().split(',')
d = input()
T = 0
F = 0
o = 0
sum = 0
b = int(a[1])
c = int(a[2])
for i in range(len(a[0])) :
    if d[i] == '-' :
        o += 1
    elif d[i] == a[0][i] :
        T += 1
        sum += b
    else :
        F += 1
        sum -= c
print(T,F,o,sum)

# 0768, 2022-02-17 08:13:47, PPx (67%)

c=input().split(',')
a=input()
c1=list(c[0])
s=0
f=0
d=0
for i in range(len(c1)):
  if a[i] == c1[i]:
    s+=1
  if a[i] != '-':
    if a[i] != c1[i]:
      f+=1
  if a[i]=='-':
    d+=1
print(s,f,d,s*int(c[1])-int(c[2])*f)


# 0769, 2022-02-17 08:14:14, PPx (67%)

A,pt,pf = input().split(",")
Y = input()
a=0
b=0
c=0
for i in range (len(A)) :
  if A[i] == Y[i] :
    a+=1
  elif Y[i] == "-":
    c+=1
  elif Y[i] == " ":
    c+=1
  else :
    b+=1
print (a,b,c,a*int(pt)-b*int(pf))

# 0770, 2022-02-17 08:12:44, PPx (67%)

a = input().split(',')
b = input()

n = 0
score = 0
cor = a[0]
nc = 0
no = 0
wro = 0

while n < len(a[0]):
    if b[n] == cor[n] :
        score = score + int(a[1])
        nc += 1
    elif b[n] == '-' or b[n] == ' ':
        score = score + 0
        no += 1
    else :
        score = score - int(a[2])
        wro += 1
    n += 1
print(str(nc) + ' ' + str(wro) + ' ' + str(no) + ' ' + str(score))


# 0771, 2022-02-17 08:17:02, PP- (67%)

n0,n1,n2=input().split(',')
y=input()
k=0
miss=0
p=0
n=0

for i in range(len(n0)):
    if len(y) != len(n0):
        y += 'P'
        miss+=1
    if y[i]=='-':
        miss+=1
        n-=1
for i in range(len(n0)):
    if y[i]==n0[i]:
        k+=int(n1)
        p+=1
    elif y[i]=='-' or y[i]=='P':
        n+=1
    else:
        k -= int(n2)
        n += 1
if k<0:
    k=0
print(p,n,miss,k)

Max Score = 33


# 0772, 2022-02-17 08:08:58, xxx (0%)

test = input().split(',')
ans = input()
ans += '-'*(len(test)-len(ans))
no = str(len(test)-len(ans))
point, c_true, c_false = 0,0,0
for i in range(len(test)) :
    if ans[i] == '-' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[i] :
        point -= int(test[2])
        c_false       
if no < 0 :
    no = 0       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))

# 0773, 2022-02-17 08:10:44, xxx (0%)

test = input().split(',')
ans = input()
ans += '-'*(len(test)-len(ans))
no = str(len(test)-len(ans))
point, c_true, c_false = 0,0,0
for i in range(len(ans)) :
    if ans[i] == '-' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[i] :
        point -= int(test[2])
        c_false       
if int(no) < 0 :
    no = '0'       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))

# 0774, 2022-02-17 08:10:59, xxx (0%)

test = input().split(',')
ans = input()
ans += '-'*(len(test)-len(ans))
no = str(len(test)-len(ans))
point, c_true, c_false = 0,0,0
for i in range(len(ans)) :
    if ans[i] == '-' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[i] :
        point -= int(test[2])
        c_false       
if int(no) < 0 :
    no = '0'       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))

# 0775, 2022-02-17 08:12:34, --- (0%)

test = input().split(',')
ans = input()
ans += 'ก'*(len(test[0])-len(ans))
no = str(len(test)-len(ans))
point, c_true, c_false = 0,0,0
for i in range(len(ans)) :
    if ans[i] == 'ก' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[0][i] :
        point -= int(test[2])
        c_false       
if int(no) < 0 :
    no = '0'       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))

# 0776, 2022-02-17 08:14:08, --- (0%)

test = input().split(',')
ans = input()
ans += 'ก'*(len(test[0])-len(ans))
no = str(len(test[0])-len(ans))
point, c_true, c_false = 0,0,0
for i in range(len(ans)) :
    if ans[i] == 'ก' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[0][i] :
        point -= int(test[2])
        c_false       
if int(no) < 0 :
    no = '0'       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))

# 0777, 2022-02-17 08:14:55, P-- (33%)

test = input().split(',')
ans = input()
ans += 'ก'*(len(test[0])-len(ans))
no = str(len(test[0])-len(ans))
point, c_true, c_false = 0,0,0
for i in range(len(ans)) :
    if ans[i] == 'ก' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[0][i] :
        point -= int(test[2])
        c_false += 1       
if int(no) < 0 :
    no = '0'       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))

# 0778, 2022-02-17 08:15:28, P-- (33%)

test = input().split(',')
ans = input()
no = str(len(test[0])-len(ans))
ans += 'ก'*(len(test[0])-len(ans))

point, c_true, c_false = 0,0,0
for i in range(len(ans)) :
    if ans[i] == 'ก' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[0][i] :
        point -= int(test[2])
        c_false += 1       
if int(no) < 0 :
    no = '0'       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))

# 0779, 2022-02-17 08:17:00, xxx (0%)

test = input().split(',')
ans = input()
no = str(len(test[0])-len(ans))
ans += 'ก'*(len(test[0])-len(ans))

point, c_true, c_false = 0,0,0
for i in range(len(ans)) :
    if ans[i] == 'ก' or an[i] == '-' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[0][i] :
        point -= int(test[2])
        c_false += 1       
if int(no) < 0 :
    no = '0'       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))

# 0780, 2022-02-17 08:17:13, P-- (33%)

test = input().split(',')
ans = input()
no = str(len(test[0])-len(ans))
ans += 'ก'*(len(test[0])-len(ans))

point, c_true, c_false = 0,0,0
for i in range(len(ans)) :
    if ans[i] == 'ก' or ans[i] == '-' :
        point += 0
    elif ans[i] == test[0][i] :
        point += int(test[1])
        c_true += 1
    elif ans[i] != test[0][i] :
        point -= int(test[2])
        c_false += 1       
if int(no) < 0 :
    no = '0'       
if point < 0 :
    point = 0
print(str(c_true),str(c_false),no,str(point))


# 0781, 2022-02-17 08:12:31, xxx (0%)

an, p, m = input().split(',')
ip = input()
i = 0
sum = 0
c = 0
f = 0
non = len(an) - len(ip)
while i < len(an):
    if an[i] == ip[i]:
        sum += int(p)
        c += 1
    if an[i] != ip[i]:
        sum -= m
        f += 1
    i += 1
if sum < 0:
    sum = 0

print(str(c), str(f),str(non), str(sum))
# 0782, 2022-02-17 08:13:05, P-x (33%)

an, p, m = input().split(',')
ip = input()
i = 0
sum = 0
c = 0
f = 0
non = len(an) - len(ip)
while i < len(an):
    if an[i] == ip[i]:
        sum += int(p)
        c += 1
    if an[i] != ip[i]:
        sum -= int(m)
        f += 1
    i += 1
if sum < 0:
    sum = 0

print(str(c), str(f),str(non), str(sum))
# 0783, 2022-02-17 08:14:42, --x (0%)

an, p, m = input().split(',')
ip = input()
i = 0
sum = 0
c = 0
f = 0
non = len(an) - len(ip)
while i < len(an):
    if an[i] == ip[i]:
        sum += int(p)
        c += 1
    if an[i] != ip[i] and ip[i] == 'T' or ip[i] == 'F':
        sum -= int(m)
        f += 1
    i += 1
if sum < 0:
    sum = 0

print(str(c), str(f),str(non), str(sum))
# 0784, 2022-02-17 08:15:23, --x (0%)

an, p, m = input().split(',')
ip = input()
i = 0
sum = 0
c = 0
f = 0
non = len(an) - len(ip)
while i < len(an):
    if an[i] == ip[i]:
      sum += int(p)
      c += 1
    if an[i] != ip[i] and ip[i] == 'T' or ip[i] == 'F':
      sum -= int(m)
      f += 1
    i += 1
if sum < 0:
    sum = 0

print(str(c), str(f),str(non), str(sum))
# 0785, 2022-02-17 08:16:38, --x (0%)

an, p, m = input().split(',')
ip = input()
i = 0
sum = 0
c = 0
f = 0
non = len(an) - len(ip)
while i < len(an):
    if an[i] == ip[i:i+1]:
      sum += int(p)
      c += 1
    if an[i] != ip[i] and ip[i] == 'T' or ip[i] == 'F':
      sum -= int(m)
      f += 1
    i += 1
if sum < 0:
    sum = 0

print(str(c), str(f),str(non), str(sum))
# 0786, 2022-02-17 08:17:00, --- (0%)

an, p, m = input().split(',')
ip = input()
i = 0
sum = 0
c = 0
f = 0
non = len(an) - len(ip)
while i < len(an):
    if an[i] == ip[i:i+1]:
        sum += int(p)
        c += 1
    if an[i] != ip[i:i+1] and ip[i:i+1] == 'T' or ip[i:i+1] == 'F':
        sum -= int(m)
        f += 1
    i += 1
if sum < 0:
    sum = 0

print(str(c), str(f),str(non), str(sum))

# 0787, 2022-02-17 08:14:59, P-- (33%)

key, score, minus = input().split(',')
ans = input()
score = int(score); minus = int(minus)
ursc = 0
m = 0
cr = 0
w = 0
for i in range(len(ans)):
    if ans[i] == key[i]:
        ursc += score
        cr += 1
    else:
        m += minus
        w += 1
print(cr, w, len(key)-len(ans), ursc)
# 0788, 2022-02-17 08:15:22, P-- (33%)

key, score, minus = input().split(',')
ans = input()
score = int(score); minus = int(minus)
ursc = 0
m = 0
cr = 0
w = 0
for i in range(len(ans)):
    if ans[i] == key[i]:
        ursc += score
        cr += 1
    else:
        m += minus
        w += 1
if ursc < 0:
  ursc = 0
print(cr, w, len(key)-len(ans), ursc)
# 0789, 2022-02-17 08:16:26, compilation error (0%)

key, score, minus = input().split(',')
ans = input()
score = int(score); minus = int(minus)
ursc = 0
m = 0
cr = 0
w = 0
for i in range(len(ans)):
    if ans[i] == key[i]:
        ursc += score
        cr += 1
    else:
        m += minus
        w += 
ursc -= minus
if ursc < 0:
  ursc = 0
print(cr, w, len(key)-len(ans), ursc)
# 0790, 2022-02-17 08:16:36, compilation error (0%)

key, score, minus = input().split(',')
ans = input()
score = int(score); minus = int(minus)
ursc = 0
m = 0
cr = 0
w = 0
for i in range(len(ans)):
    if ans[i] == key[i]:
        ursc += score
        cr += 1
    else:
        m += minus
        w += 
ursc -= m
if ursc < 0:
  ursc = 0
print(cr, w, len(key)-len(ans), ursc)
# 0791, 2022-02-17 08:16:54, P-- (33%)

key, score, minus = input().split(',')
ans = input()
score = int(score); minus = int(minus)
ursc = 0
m = 0
cr = 0
w = 0
for i in range(len(ans)):
    if ans[i] == key[i]:
        ursc += score
        cr += 1
    else:
        m += minus
        w += 1
ursc -= m
if ursc < 0:
  ursc = 0
print(cr, w, len(key)-len(ans), ursc)

# 0792, 2022-02-17 08:09:10, --- (0%)

x = input().split(",")
y = input()
s = 0
c = 0
i = 0
n = 0
score = 0
x[1] = int(x[1])
x[2] = int(x[2])
if len(x[0]) == len(y):
    while s < len(y):
        if x[0] == y[s]:
            score += x[1]
            c += 1
        elif x[0] != "-" and x[0] != y[s]:
            score -= x[2]
            i += 0
        elif x[0] == "-":
            n = 0
        s += 1
elif score <= 0:
    score = 0
print(c,i,n,score)
# 0793, 2022-02-17 08:12:32, --- (0%)

x = input().split(",")
y = input()
s = 0
c = 0
i = 0
n = 0
score = 0
x0 =  str(x[0])
x1 = int(x[1])
x2 = int(x[2])
if len(x0) == len(y):
    while s < len(y):
        if x0[s] == y[s]:
            score += x1
            c += 1
        elif x0 != "-" and x0 != y[s]:
            score -= x1
            i += 0
        elif x0 == "-":
            n = 0
        s += 1
elif score <= 0:
    score = 0
print(c,i,n,score)
    
# 0794, 2022-02-17 08:14:52, --- (0%)

x = input().split(",")
y = input()
s = 0
c = 0
i = 0
n = 0
score = 0
x0 =  str(x[0])
x1 = int(x[1])
x2 = int(x[2])
if len(x0) == len(y):
    while s < len(y):
        if x0[s] == y[s]:
            score += x1
            c += 1
        elif x0[s] != "-" and x0 != y[s]:
            score -= x2
            i += 0
        elif x0[s] == "-":
            n = 0
        s += 1
elif score <= 0:
    score = 0
print(c,i,n,score)
    
        
# 0795, 2022-02-17 08:15:30, --- (0%)

x = input().split(",")
y = input()
s = 0
c = 0
i = 0
n = 0
score = 0
x0 =  str(x[0])
x1 = int(x[1])
x2 = int(x[2])
if len(x0) == len(y):
    while s < len(y):
        if x0[s] == y[s]:
            score += x1
            c += 1
        elif x0[s] != "-" and x0[s] != y[s]:
            score -= x2
            i += 0
        elif x0[s] == "-":
            n = 0
        s += 1
elif score <= 0:
    score = 0
print(c,i,n,score)
    
        
# 0796, 2022-02-17 08:16:03, P-- (33%)

x = input().split(",")
y = input()
s = 0
c = 0
i = 0
n = 0
score = 0
x0 =  str(x[0])
x1 = int(x[1])
x2 = int(x[2])
if len(x0) == len(y):
    while s < len(y):
        if x0[s] == y[s]:
            score += x1
            c += 1
        elif x0[s] != "-" and x0[s] != y[s]:
            score -= x2
            i += 1
        elif x0[s] == "-":
            n += 1
        s += 1
elif score <= 0:
    score = 0
print(c,i,n,score)

# 0797, 2022-02-17 08:12:41, compilation error (0%)

score = input().split(',')
ans = input() + '*' * (int(len(score[0])-len(ans)))
false = 0
true = 0
no = 0
for i in range(len(score)):
    if (score[0])[i] in ['T','F']:
        if (score[0])[i] == ans[i]:
            true += 1
        if (score[0])[i] != ans[i]
            false += 1
    else :
        no += 0
all_score = true*int(score[1]) - false*int(score[2])
if all_score < 0:
    all_score = 0
print(true, false, no, all_score)
# 0798, 2022-02-17 08:13:10, xxx (0%)

score = input().split(',')
ans = input() + '*' * (int(len(score[0])-len(ans)))
false = 0
true = 0
no = 0
for i in range(len(score)):
    if (score[0])[i] in ['T','F']:
        if (score[0])[i] == ans[i]:
            true += 1
        if (score[0])[i] != ans[i]:
            false += 1
    else :
        no += 0
all_score = true*int(score[1]) - false*int(score[2])
if all_score < 0:
    all_score = 0
print(true, false, no, all_score)
# 0799, 2022-02-17 08:14:23, xxx (0%)

score = input().split(',')
ans = input()
ans = input() + '*' * (int(len(score[0])-len(ans)))
false = 0
true = 0
no = 0
for i in range(len(score)):
    if (score[0])[i] in ['T','F']:
        if (score[0])[i] == ans[i]:
            true += 1
        if (score[0])[i] != ans[i]:
            false += 1
    else :
        no += 0
all_score = true*int(score[1]) - false*int(score[2])
if all_score < 0:
    all_score = 0
print(true, false, no, all_score)
# 0800, 2022-02-17 08:15:04, P-x (33%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif b[i] != a[i] :
        t += 1
        i += 1
    elif b[i] == "-" or b[i] == " " :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0801, 2022-02-17 08:16:22, --- (0%)

score = input().split(',')
ans = input()
ans = ans + '*' * (int(len(score[0])-len(ans)))
false = 0
true = 0
no = 0
for i in range(len(score)):
    if (score[0])[i] in ['T','F']:
        if (score[0])[i] == ans[i]:
            true += 1
        if (score[0])[i] != ans[i]:
            false += 1
    else :
        no += 0
all_score = true*int(score[1]) - false*int(score[2])
if all_score < 0:
    all_score = 0
print(true, false, no, all_score)

# 0802, 2022-02-17 08:14:00, xxx (0%)

x = input().split(',')
m = input()
a = len(x[0])
b = int(x[1])
c = int(x[2])
point = 0
w = 0
y = 0
t = 0
for i in range(0,a):
    if x[i] == m[i]:
        point += b
        i += 1
        t += 1
    elif x[i] != m[i]:
        if m[i] == 'T' or m[i] =='F':
            i += 1
            w += 1
        elif m[i] == ' ' or m[i] == '-':
            i += 1
            y += 1
print(t,w,y,point)
# 0803, 2022-02-17 08:15:08, xxx (0%)

k,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0804, 2022-02-17 08:15:17, xxx (0%)

k,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif (b[i] == "T" and a[i] == "F") or (b[i] == "F" and a[i] == "T") :
        t += 1
        i += 1
    else :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)
# 0805, 2022-02-17 08:15:38, P-x (33%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0
while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif b[i] != a[i] :
        t += 1
        i += 1
    elif b[i] == "-" or b[i] == " " :
        u += 1
        i += 1
kr = k*r
tf = t*f
res = kr - tf
print(k,t,u,res)

# 0806, 2022-02-17 08:11:39, xxx (0%)

true_test, true_p, false_p = input().split(',')
true_test = true_test.split()
your_test = input().split()
do_not = 0
poin = 0
do_true = 0
do_false = 0
if len(true_test) > len(your_test):
  do_not = len(true_test) - len(your_test)
  for e in range(do_not):
    your_test += [' ']
for i in range(len(true_test)):
  if true_test[i] == your_test[i]:
    poin += true_p
    do_true += 1
  else:
    poin -= false_p
    do_false += 1
if poin < 0:
  poin = 0
print(do_true, do_true, do_not, poin)
# 0807, 2022-02-17 08:13:01, --- (0%)

true_test, true_p, false_p = input().split(',')
true_test = true_test.split()
your_test = input().split()
do_not = 0
poin = 0
do_true = 0
do_false = 0
if len(true_test) > len(your_test):
  do_not = len(true_test) - len(your_test)
  for e in range(do_not):
    your_test += [' ']
for i in range(len(true_test)):
  if true_test[i] == your_test[i]:
    poin += int(true_p)
    do_true += 1
  else:
    poin -= int(false_p)
    do_false += 1
if poin < 0:
  poin = 0
print(do_true, do_true, do_not, poin)
# 0808, 2022-02-17 08:15:06, --- (0%)

true_test, true_p, false_p = input().split(',')
true_test = ' '.join(true_test).split()
your_test = ' '.join(input()).split()
do_not = 0
poin = 0
do_true = 0
do_false = 0
if len(true_test) > len(your_test):
  do_not = len(true_test) - len(your_test)
  for e in range(do_not):
    your_test += [' ']
for i in range(len(true_test)):
  if true_test[i] == your_test[i]:
    poin += int(true_p)
    do_true += 1
  else:
    poin -= int(false_p)
    do_false += 1
if poin < 0:
  poin = 0
print(do_true, do_true, do_not, poin)
# 0809, 2022-02-17 08:16:03, P-- (33%)

true_test, true_p, false_p = input().split(',')
true_test = ' '.join(true_test).split()
your_test = ' '.join(input()).split()
do_not = 0
poin = 0
do_true = 0
do_false = 0
if len(true_test) > len(your_test):
  do_not = len(true_test) - len(your_test)
  for e in range(do_not):
    your_test += [' ']
for i in range(len(true_test)):
  if true_test[i] == your_test[i]:
    poin += int(true_p)
    do_true += 1
  else:
    poin -= int(false_p)
    do_false += 1
if poin < 0:
  poin = 0
print(do_true, do_false, do_not, poin)

# 0810, 2022-02-17 08:11:57, --- (0%)

ans = input().split(",")
x = ans[0]
coan = 0
woan = 0
empan = 0
student = input()
for i in range(len(student)):
    if student[i] == x[i]:
        coan +=1
    elif student[i] == "-":
        empan +=1
    else:
        woan +=1
win_score = coan*int(ans[1])
final = win_score-(woan*int(woan))
print(coan,woan,empan,final)
# 0811, 2022-02-17 08:13:57, --- (0%)

ans = input().split(",")
x = ans[0]
coan = 0
woan = 0
empan = 0
student = input()
for i in range(len(student)):
    if student[i] == x[i]:
        coan +=1
    elif student[i] == "-":
        empan +=1
    else:
        woan +=1
win_score = coan*int(ans[1])
final = win_score-(woan*int(woan))
print(coan,woan,empan,max(final,0))
# 0812, 2022-02-17 08:14:29, --- (0%)

ans = input().split(",")
x = ans[0]
coan = 0
woan = 0
empan = 0
student = input()
for i in range(len(student)):
    if student[i] == x[i]:
        coan +=1
    else:
        woan+=1
win_score = coan*int(ans[1])
final = win_score-(woan*int(woan))
print(coan,woan,empan,max(final,0))
# 0813, 2022-02-17 08:15:16, P-- (33%)

ans = input().split(",")
x = ans[0]
coan = 0
woan = 0
empan = 0
student = input()
for i in range(len(student)):
    if student[i] == x[i]:
        coan +=1
    else:
        woan+=1
win_score = coan*int(ans[1])
final = win_score-(woan*int(ans[2]))
print(coan,woan,empan,max(final,0))

# 0814, 2022-02-17 08:13:40, P-x (33%)

sol = input().split(",")
ans = input()
score = 0
T = 0
F = 0
No = 0
s = sol[0]


for i in range(len(sol[0])):
    if s[i] == ans[i]:
        score+=int(sol[1])
        T+=1
    elif s[i] != ans[i]:
        score-=int(sol[2])
        F+=1
    elif s[i] == "-" or " ":
        No+=1

    
        
print(T,F,No,score)
# 0815, 2022-02-17 08:15:58, P-x (33%)

sol = input().split(",")
ans = input()
score = 0
T = 0
F = 0
No = 0
s = sol[0]

if len(s)==len(ans):
    for i in range(len(sol[0])):
        if s[i] == ans[i]:
            score+=int(sol[1])
            T+=1
        elif s[i] != ans[i]:
            score-=int(sol[2])
            F+=1
if len(s)!=len(ans):
    for i in range(len(sol[0])):
        if s[i] == ans[i]:
            score+=int(sol[1])
            T+=1
        elif s[i] != ans[i]:
            score-=int(sol[2])
            F+=1
    No=len(s)-len(ans)
    
        
print(T,F,No,score)

# 0816, 2022-02-17 08:16:03, P-x (33%)

sol = input().split(",")
ans = input()
score = 0
T = 0
F = 0
No = 0
s = sol[0]

if len(s)==len(ans):
    for i in range(len(sol[0])):
        if s[i] == ans[i]:
            score+=int(sol[1])
            T+=1
        elif s[i] != ans[i]:
            score-=int(sol[2])
            F+=1
if len(s)!=len(ans):
    for i in range(len(sol[0])):
        if s[i] == ans[i]:
            score+=int(sol[1])
            T+=1
        elif s[i] != ans[i]:
            score-=int(sol[2])
            F+=1
    No=len(s)-len(ans)
    
        
print(T,F,No,score)
# 0817, 2022-02-17 08:17:11, --- (0%)

sol = input().split(",")
ans = input()
score = 0
T = 0
F = 0
No = 0
s = sol[0]

if len(s)==len(ans):
    for i in range(len(s[0])):
        if s[i] == ans[i]:
            score+=int(sol[1])
            T+=1
        elif s[i] != ans[i]:
            score-=int(sol[2])
            F+=1
if len(s)!=len(ans):
    for i in range(len(s[0])):
        if s[i] == ans[i]:
            score+=int(sol[1])
            T+=1
        elif s[i] != ans[i]:
            score-=int(sol[2])
            F+=1
    No=len(s)-len(ans)
    
        
print(T,F,No,score)

# 0818, 2022-02-17 08:13:24, compilation error (0%)

x = input().split(",")
s = x[0]
a = input()
p = 0
correct = 0
incorrect = 0
blank = len(x[0]) - len(a)
for i in range(len(s)) :
    if s[i] == a[i] :
        p += x[1]
        correct += 1
    elif : s[i] == "-"
    blank += 1
    else :
        p -= x[2]
        incorrect += 1
print(correct,incorrect,blank,p,)
# 0819, 2022-02-17 08:15:30, P-x (33%)

x = input().split(",")
s = x[0]
a = input()
p = 0
correct = 0
incorrect = 0
blank = len(x[0]) - len(a)
for i in range(len(s)) :
    if s[i] == a[i] :
        p += int(x[1])
        correct += 1
    elif s[i] == "-" :
        blank += 1
    else :
        p -= int(x[2])
        incorrect += 1
#if p < 0
print(correct,incorrect,blank,p,)
# 0820, 2022-02-17 08:16:02, P-x (33%)

x = input().split(",")
s = x[0]
a = input()
p = 0
correct = 0
incorrect = 0
blank = len(x[0]) - len(a)
for i in range(len(s)) :
    if s[i] == a[i] :
        p += int(x[1])
        correct += 1
    elif s[i] == "-" :
        blank += 1
    else :
        p -= int(x[2])
        incorrect += 1
if p < 0 :
    p = 0
print(correct,incorrect,blank,p,)

# 0821, 2022-02-17 08:16:59, P-x (33%)

x = input().split(",")
s = x[0]
a = input()
p = 0
correct = 0
incorrect = 0
blank = len(x[0]) - len(a)
for i in range(len(s)) :
    if s[i] == a[i] :
        p += int(x[1])
        correct += 1
    elif s[i] == "-" :
        blank += 1
    else :
        p -= int(x[2])
        incorrect += 1
if p < 0 :
    p = 0
print(correct,incorrect,blank,p,)


# 0822, 2022-02-17 08:12:52, xxx (0%)

ans, correct, wrong = input().split(",")
stu_ans = input()
blank_count = 0
correct_count = 0
wrong_count = 0
point = 0
while True:
  for i in ans:
    if stu_ans[i] == ans[i]:
      correct_count += 1
      point += correct
    elif stu_ans[i] != ans[i]:
      wrong_count += 1
      point -= wrong
    elif stu_ans[i] == '-':
      blank_count += 1
    i += 1

print(correct_count, wrong_count, blank_count, point)
# 0823, 2022-02-17 08:14:32, xxx (0%)

ans, correct, wrong = input().split(",")
stu_ans = input()
blank_count = 0
correct_count = 0
wrong_count = 0
point = 0
for i in range(len(stu_ans)):
    if stu_ans[i] == ans[i]:
      correct_count += 1
      point += correct
    elif stu_ans[i] != ans[i]:
      wrong_count += 1
      point -= wrong
    blank_count += len(ans) - len(stu_ans)
    i += 1

print(correct_count, wrong_count, blank_count, point)
# 0824, 2022-02-17 08:15:33, --- (0%)

ans, correct, wrong = input().split(",")
stu_ans = input()
blank_count = 0
correct_count = 0
wrong_count = 0
point = 0
for e in range(len(stu_ans)):
  if stu_ans[e] == ans[e]:
    correct_count += 1
  elif stu_ans[e] != '-':
    wrong_count += 1
  else:
    blank_count += 1
blank_count += len(ans) - len(stu_ans)
if point < 0:
    point = 0
# 0825, 2022-02-17 08:16:20, --P (33%)

ans, correct, wrong = input().split(",")
stu_ans = input()
blank_count = 0
correct_count = 0
wrong_count = 0
point = 0
for e in range(len(stu_ans)):
  if stu_ans[e] == ans[e]:
    correct_count += 1
  elif stu_ans[e] != '-':
    wrong_count += 1
  else:
    blank_count += 1
blank_count += len(ans) - len(stu_ans)
if point < 0:
    point = 0
print(correct_count,wrong_count,blank_count,point)

# 0826, 2022-02-17 08:11:08, -Px (33%)

t=input().split(",")
f=t[0]
ans=input()
num1=len(t[0])
ans1=0
notdo=0
notco=0
for i in range(len(t[0])):
    if ans[i]==f[i]:
        ans1+=1
    elif ans[i]!=f[i]:
        if ans[i]=='-':
            notdo+=1
        else:
            notco+=1
score=( ans1*int(t[1])) - (notco*(int(t[2])))
print(ans1,notdo,notco,score)
# 0827, 2022-02-17 08:13:03, -Px (33%)

t=input().split(",")
f=t[0]
ans=input()
num1=len(t[0])
ans1=0
notdo=0
notco=0
for i in range(len(t[0])):
    if ans[i]==f[i]:
        ans1+=1
    elif ans[i]!=f[i]:
        if ans[i]=='-':
            notdo+=1
        else:
            notco+=1
score=( ans1*int(t[1])) - (notco*(int(t[2])))
if score<=0:
    score=0
print(ans1,notdo,notco,score)
# 0828, 2022-02-17 08:15:22, xxx (0%)

t=input().split(",")
f=t[0]
ans=input()
if len(ans)<=len(f):
    ans+=0*(len(f)-len(ans))
num1=len(t[0])
ans1=0
notdo=0
notco=0
for i in range(len(t[0])):
    if ans[i]==f[i]:
        ans1+=1
    elif ans[i]!=f[i]:
        if ans[i]=='-':
            notdo+=1
        else:
            notco+=1
score=( ans1*int(t[1])) - (notco*(int(t[2])))
if score<=0:
    score=0
print(ans1,notdo,notco,score)
# 0829, 2022-02-17 08:15:35, -Px (33%)

t=input().split(",")
f=t[0]
ans=input()
num1=len(t[0])
ans1=0
notdo=0
notco=0
for i in range(len(t[0])):
    if ans[i]==f[i]:
        ans1+=1
    elif ans[i]!=f[i]:
        if ans[i]=='-':
            notdo+=1
        else:
            notco+=1
score=( ans1*int(t[1])) - (notco*(int(t[2])))
if score<=0:
    score=0
print(ans1,notdo,notco,score)

# 0830, 2022-02-17 08:14:05, P-x (33%)

answer=input()
answer1,plus,minus=answer.split(',')
#print(answer1,plus,minus)
solve=input()
l=len(answer1)
score=0
count_correct=0
count_false=0
count_blank=0
for i in range(0,l) :
    if(answer1[i]==solve[i] and (answer[i]=='T' or answer[i]=='F')) :
        score=score+int(plus)
        count_correct+=1
    elif(answer[i]==' ') :
        score+=0
        count_blank+=1
    else :
        score=score-int(minus)
        count_false+=1
#print(score)
print(count_correct,count_false,count_blank,score)
# 0831, 2022-02-17 08:16:23, P-x (33%)

answer=input()
answer1,plus,minus=answer.split(',')
#print(answer1,plus,minus)
solve=input()
l=len(answer1)
score=0
count_correct=0
count_false=0
count_blank=0
for i in range(0,l) :
    if(answer1[i]==solve[i] and (answer[i]=='T' or answer[i]=='F')) :
        score=score+int(plus)
        count_correct+=1
    elif(solve[i]==' ') :
        score+=0
        count_blank+=1
    else :
        score=score-int(minus)
        count_false+=1
#print(score)
print(count_correct,count_false,count_blank,score)
# 0832, 2022-02-17 08:16:50, xxx (0%)

answer=input()
answer1,plus,minus=answer.split(',')
#print(answer1,plus,minus)
solve=input()
l=len(answer1)
score=0
count_correct=0
count_false=0
count_blank=0
for i in range(0,l) :
    if(answer1[i]==solve[i] and (sovle[i]=='T' or solve[i]=='F')) :
        score=score+int(plus)
        count_correct+=1
    elif(solve[i]==' ') :
        score+=0
        count_blank+=1
    else :
        score=score-int(minus)
        count_false+=1
#print(score)
print(count_correct,count_false,count_blank,score)
# 0833, 2022-02-17 08:17:07, P-x (33%)

answer=input()
answer1,plus,minus=answer.split(',')
#print(answer1,plus,minus)
solve=input()
l=len(answer1)
score=0
count_correct=0
count_false=0
count_blank=0
for i in range(0,l) :
    if(answer1[i]==solve[i] and (solve[i]=='T' or solve[i]=='F')) :
        score=score+int(plus)
        count_correct+=1
    elif(solve[i]==' ') :
        score+=0
        count_blank+=1
    else :
        score=score-int(minus)
        count_false+=1
#print(score)
print(count_correct,count_false,count_blank,score)

# 0834, 2022-02-17 08:09:42, xxx (0%)

a1,a2,a3 = [i for i in input().split(',')]
b1,b2,b3 = [i for i in input().split(',')]
t = 0
f = 0
for i in range(len(a1)) :
  if a1[i]==b1[i]:
    t+=1
  else:
    f+=1
q = len(b1)-len(a1)
x= t*int(a2)
y= f*int(a3)
d = x-y
print(t,f,q,d)
# 0835, 2022-02-17 08:11:12, P-x (33%)

a1,a2,a3 = [i for i in input().split(',')]
b1 = input()
t = 0
f = 0
for i in range(len(a1)) :
  if a1[i]==b1[i]:
    t+=1
  else:
    f+=1
q = len(b1)-len(a1)
x= t*int(a2)
y= f*int(a3)
d = x-y
print(t,f,q,d)
# 0836, 2022-02-17 08:13:41, P-- (33%)

a1,a2,a3 = [i for i in input().split(',')]
b1 = input()
t = 0
f = 0
for i in range(len(b1)) :
  if a1[i]==b1[i]:
    t+=1
  else:
    f+=1
q = len(b1)-len(a1)
x= t*int(a2)
y= f*int(a3)
d = x-y
print(t,f,q,d)

# 0837, 2022-02-17 08:13:52, P-x (33%)

ans = input().split(',')
sol = input()

ans1 = ans[0]
yes_per = int(ans[1])
no_per = int(ans[2])
y = 0
n = 0
sp = 0
for i in range(len(ans1)):
    if sol[i] == ans1[i]:
        y += 1
    if sol[i] != ans1[i] and ans1[i] == '-':
        sp +=1
    if sol[i] != ans1[i]:
        n += 1
        
print(str(y),str(n),str(sp),(int(y)*yes_per)-(int(n)*no_per))
# 0838, 2022-02-17 08:15:31, xxx (0%)

ans = input().split(',')
sol = input()

ans1 = ans[0]
yes_per = int(ans[1])
no_per = int(ans[2])
y = 0
n = 0
sp = 0
for i in range(len(ans1)):
    if sol[i] == ans1[i]:
        y += 1
    if sol[i] != ans1[i] and ans1[i] == '-':
        sp +=1
    if sol[i] != ans1[i] and ans[i] != '-':
        n += 1
        
print(str(y),str(n),str(sp),(int(y)*yes_per)-(int(n)*no_per))
# 0839, 2022-02-17 08:15:51, P-x (33%)

ans = input().split(',')
sol = input()

ans1 = ans[0]
yes_per = int(ans[1])
no_per = int(ans[2])
y = 0
n = 0
sp = 0
for i in range(len(ans1)):
    if sol[i] == ans1[i]:
        y += 1
    if sol[i] != ans1[i] and ans1[i] == '-':
        sp +=1
    if sol[i] != ans1[i] :
        n += 1
        
print(str(y),str(n),str(sp),(int(y)*yes_per)-(int(n)*no_per))

# 0840, 2022-02-17 08:14:51, --- (0%)

ans = input().split(",")
word = list(input())

score = 0
t_socre = int(ans[1])
do = 0
f_score = int(ans[2])
miss = 0
ans_list = list(ans[0])
dont = 0

dont += len(ans)-len(word)

for i in range (len(ans)):
    if word[i] == ans[i]:
        score += t_score
        do += 1
    elif word[i] != ans[i]:
        score -= f_score
        miss += 1
    elif word[i] == "-":
        dont += 1
print(do,miss,dont,score)
# 0841, 2022-02-17 08:16:16, xxx (0%)

ans = input().split(",")
word = list(input())

score = 0
t_socre = int(ans[1])
do = 0
f_score = int(ans[2])
miss = 0
ans_list = list(ans[0])
dont = 0

dont += len(ans_list)-len(word)

for i in range (len(ans_list)):
    if word[i] == ans_list[i]:
        score += t_score
        do += 1
    elif word[i] != ans_list[i]:
        score -= f_score
        miss += 1
    elif word[i] == "-":
        dont += 1
print(do,miss,dont,score)
        
# 0842, 2022-02-17 08:17:17, P-x (33%)

ans = input().split(",")
word = list(input())

score = 0
t_score = int(ans[1])
do = 0
f_score = int(ans[2])
miss = 0
ans_list = list(ans[0])
dont = 0

dont += len(ans_list)-len(word)

for i in range (len(ans_list)):
    if word[i] == ans_list[i]:
        score += t_score
        do += 1
    elif word[i] != ans_list[i]:
        score -= f_score
        miss += 1
    elif word[i] == "-":
        dont += 1
print(do,miss,dont,score)
        

# 0843, 2022-02-17 08:11:12, P-x (33%)

a = input().split(",")
b = input()
c = a[0]
d = 0 #คะแนน
e = 0 # ถูก
f = 0 #ผิด
g = 0
for i in range(0,len(a[0])):
    if c[i] == b[i]:
        d += int(a[1])
        e += 1
    if c[i] != b[i]:
        d -= int(a[2])
        f += 1
    if c[i] == "-":
        g += 1
if d <= 0:
    d = 0
print(e,f,g,d)


# 0844, 2022-02-17 08:12:46, P-x (33%)

a = input().split(",")
b = input()
c = a[0]
d = 0 #คะแนน
e = 0 # ถูก
f = 0 #ผิด
g = 0
for i in range(0,len(a[0])):
    if c[i] == b[i]:
        d += int(a[1])
        e += 1
    if c[i] != b[i]:
        if c[i] == "-":
            g += 1
        else:
            d -= int(a[2])
            f += 1
if d <= 0:
    d = 0
print(e,f,g,d)

# 0845, 2022-02-17 08:14:04, P-x (33%)

a = input().split(",")
b = input()
c = a[0]
d = 0 #คะแนน
e = 0 # ถูก
f = 0 #ผิด
g = 0
for i in range(0,len(a[0])):
    if c[i] == b[i]:
        d += int(a[1])
        e += 1
    if c[i] != b[i]:
        d -= int(a[2])
        f += 1
    if c[i] == "-":
        g += 1
        f += 1
if d <= 0:
    d = 0
print(e,f,g,d)



# 0846, 2022-02-17 08:11:55, P-x (33%)

key = input().split(',')
ans = input()
k = key[0]
p = key[1]
d = key[2]
cc = 0
cw = 0
cn = 0
score = 0
for i in range(len(k)):
    if ans[i] == k[i]:
        score += int(p)
        cc += 1
    elif ans[i] == ['-']:
        score += 0
        cn += 1
    else:
        score -= int(d)
        cw += 1
print(cc, cw, cn, score)
    

# 0847, 2022-02-17 08:14:59, P-x (33%)

key = input().split(',')
ans = input()
k = key[0]
p = key[1]
d = key[2]
cc = 0
cw = 0
cn = 0
score = 0
for i in range(len(k)):
    if ans[i] == k[i]:
        score += int(p)
        cc += 1
    if ans[i] == ['-'] or ans[i] == [' ']:
        score += 0
        cn += 1
    if ans[i] != k[i] and ans[i] != k[i]:
        score -= int(d)
        cw += 1
print(cc, cw, cn, score)
    

# 0848, 2022-02-17 08:15:19, P-x (33%)

key = input().split(',')
ans = input()
k = key[0]
p = key[1]
d = key[2]
cc = 0
cw = 0
cn = 0
score = 0
for i in range(len(k)):
    if ans[i] == k[i]:
        score += int(p)
        cc += 1
    elif ans[i] == ['-'] or ans[i] == [' ']:
        score += 0
        cn += 1
    elif ans[i] != k[i] and ans[i] != k[i]:
        score -= int(d)
        cw += 1
print(cc, cw, cn, score)

# 0849, 2022-02-17 08:11:33, P-x (33%)

x = input().split(',')
y = input()

m = x[0]
n = x[1]
o = x[2]
c = 0
d = 0
e = 0
for i in range(len(m)):
    if y[i] in m[i]:
        c += 1
       
    if y[i] not in m[i]:
        d += 1
        
        
    if y[i] == '-':
        e+= 1
        
k = c*int(n)
m = c*int(o)
        
        
print( str(c) +" " + str(d) + " " + str(e) + " " + str(int(k-m)))   

# 0850, 2022-02-17 08:15:23, xxx (0%)

k,m,n = input().split(',')
ans = input()
a=len(x)


b = len(ans)
mi = min(a,b)
print(mi)
s1 = 0
s2 = 0
s3 = 0
s4 =0



for i in range(mi):
    if k[i] == 'T' and ans[i] == 'T':
        s4 += int(m)
        s1 += 1
    if k[i] == 'T' and ans[i] == 'F':
        s4 -= int(n)
        s2+=1
    if ans[i] == '-':
        s3+=1
print(s1,s2,s3,s4)
# 0851, 2022-02-17 08:15:52, P-x (33%)

x = input().split(',')
y = input()

m = x[0]
n = x[1]
o = x[2]
c = 0
d = 0
e = 0
for i in range(len(m)):
    
    if y[i] in m[i]:
        c += 1
       
    if y[i] not in m[i]:
        d += 1
        
        
        
    if y[i] == '-':
        e+= 1
        
k = c*int(n)
m = c*int(o)
        
        
print( str(c) +" " + str(d) + " " + str(e) + " " + str(int(k-m)))   



# 0852, 2022-02-17 08:14:29, P-- (33%)

a=input().split(',')
b=input()
if len(b)!=len(a[0]):
    b+=" "*(len(a[0])-len(b))
p=int(a[1])
c=int(a[2])
q=a[0]
s=0
for i in range(len(q)):
    if q[i]==b[i]:
        s+=1
f=len(a[0])-s
point=(s*p)-(f*c)

if point >=0:
    print(s,f,len(a[0])-len(b),point)
else:
    point=0
    print(s,f,len(a[0])-len(b),point)



# 0853, 2022-02-17 08:15:55, P-- (33%)

a=input().split(',')
b=input()
if len(b)!=len(a[0]):
    b+=" "*(len(a[0])-len(b))
p=int(a[1])
c=int(a[2])
q=a[0]
s=0
for i in range(len(q)):
    if q[i]==b[i]:
        s+=1
f=len(b)-s
point=(s*p)-(f*c)

if point >=0:
    print(s,f,len(a[0])-len(b),point)
else:
    point=0
    print(s,f,len(a[0])-len(b),point)



# 0854, 2022-02-17 08:17:02, --- (0%)

a=input().split(',')
b=input()
if len(b)!=len(a[0]):
    b+=" "*(len(a[0])-len(b))
p=int(a[1])
c=int(a[2])
q=a[0]
s=1
for i in range(len(q)):
    if q[i]==b[i]:
        s+=1
f=len(a[0])-s
point=(s*p)-(f*c)

if point >=0:
    print(s,f,len(a[0])-len(b),point)
else:
    point=0
    print(s,f,len(a[0])-len(b),point)




# 0855, 2022-02-17 08:13:36, P-- (33%)

x = input().split(',')
y = input()
r = 0
p = 0
w = 0
b = 0
for i in range(len(y)):
    if x[0][i] == y[i]:
        r += 1
    elif x[0][i] != y[i]:
        w += 1
b = len(y) - len(x[0])
p = int(r)*(int(x[1])) - int(w)*(int(x[2]))
print(r,w,b,p)
    
        
        

# 0856, 2022-02-17 08:14:44, P-- (33%)

x = input().split(',')
y = input()
r = 0
p = 0
w = 0
b = 0
for i in range(len(y)):
    if y[i] == x[0][i]:
        r += 1
    elif y[i] != x[0][i]:
        w += 1
b = len(y) - len(x[0])
p = int(r)*(int(x[1])) - int(w)*(int(x[2]))
print(r,w,b,p)
    
        
        

# 0857, 2022-02-17 08:16:16, xxx (0%)

x = input().split(',')
y = input()
r = 0
p = 0
w = 0
b = 0
for i in range(len(y)+1):
    if y[i] == x[0][i]:
        r += 1
    elif y[i] != x[0][i]:
        w += 1
b = len(y) - len(x[0])
p = int(r)*(int(x[1])) - int(w)*(int(x[2]))
print(r,w,b,p)

# 0858, 2022-02-17 08:08:22, P-x (33%)

sol=input().split(',')
ans=input()
c=0
score=0
for i in range (len(sol[0])):
    if ans[i]==sol[0][i]:
        c+=1
score=c*(int(sol[1]))-(len(sol[0])-c)*int(sol[2])
print(c,len(sol[0])-int(c),len(sol[0])-len(ans),score)
# 0859, 2022-02-17 08:13:00, P-- (33%)

sol=input().split(',')
ans=input()
c=0
score=0
for i in range (len(ans)):
    if ans[i]==sol[0][i]:
        c+=1
    
score=c*(int(sol[1]))-(len(ans)-c)*int(sol[2])
if score<0:
    score=0
print(c,len(ans)-c,len(sol[0])-len(ans),score)
# 0860, 2022-02-17 08:14:45, P-- (33%)

sol=input().split(',')
ans=input()
c=0
score=0
for i in range (len(ans)):
    if ans[i]==sol[0][i]:
        c+=1
    elif ans[i]=='-':
        c+=0
    
score=c*(int(sol[1]))-(len(ans)-c)*int(sol[2])
if score<0:
    score=0
print(c,len(ans)-c,len(sol[0])-len(ans),score)

# 0861, 2022-02-17 08:14:25, P-x (33%)

ans = input().split(",")
answer = ans[0]
true = int(ans[1])
false = int(ans[2])
key = input()

n = 0 #ข้อที่ถูก
for i in range(len(answer)):
    if answer[i] == key[i]:
        n += 1

a = 0 #ข้อที่ไม่ได้ทำ
if len(answer) < len(key):
    for ch in answer:
        if ch in "-":
            a += 1
    a += (len(key)-len(answer))
else:
    for ch in answer:
        if ch in "-":
            a += 1
            
f = len(key) - a - n #ข้อที่ผิด

score = n*true-n*false

print(n,f,a,score)

# 0862, 2022-02-17 08:16:40, P-x (33%)

ans = input().split(",")
answer = ans[0]
true = int(ans[1])
false = int(ans[2])
key = input()

n = 0 #ข้อที่ถูก
for i in range(len(answer)):
    if answer[i] == key[i]:
        n += 1

a = 0 #ข้อที่ไม่ได้ทำ
if len(answer) < len(key):
    for ch in answer:
        if ch in "-":
            a += 1
    a += (len(key)-len(answer))
else:
    for ch in answer:
        if ch in "-":
            a += 1
            
f = len(key) - a - n #ข้อที่ผิด

score = n*true-f*false

print(n,f,a,score)

# 0863, 2022-02-17 08:12:24, P-- (33%)

x = input().split(",")
r = x[0]
y = input()
a = 0
b = 0
c = 0
p = 0
for i in range(len(y)):
    if r[i] == y[i]:
        a += 1
        p += int(x[1])
    if r[i] != y[i]:
        if r[i] == '-':
            c += 1
        else:
            b += 1
            p -= int(x[2])
print(a,b,c,p)
        
# 0864, 2022-02-17 08:15:49, compilation error (0%)

x = input().split(",")
r = x[0]
y = input()
a = 0
b = 0
c = 0
p = 0
for i in range(len(y)):
    if r[i] == y[i]:
        a += 1
        p += int(x[1])
    if r[i] != y[i]:
        if y[i] == '-':
            c += 1
        if y[i] != r[i]
            b += 1
            p -= int(x[2])
print(a,b,c,p)
        

# 0865, 2022-02-17 08:12:09, P-x (33%)


x = input().split(',')
sol=x[0]
c=int(x[1])
w=int(x[2])
score=0
count=0
wrong=0
not_do=0
ans=input()
ans=list(ans)
for i in range(len(sol)):
  if sol[i]==ans[i]:
    score+=c
    count+=1
  elif sol[i] != ans[i]:
    score-=w
    wrong+=1
  elif ans[i]=='-':
    score+=0
    not_do+=1
print(count,wrong,not_do,score)
# 0866, 2022-02-17 08:13:01, P-x (33%)

x = input().split(',')
sol=x[0]
c=int(x[1])
w=int(x[2])
score=0
count=0
wrong=0
not_do=0
ans=input()
for i in range(len(sol)):
  if sol[i]==ans[i]:
    score+=c
    count+=1
  elif sol[i] != ans[i]:
    score-=w
    wrong+=1
  elif ans[i]=='-':
    score+=0
    not_do+=1
print(count,wrong,not_do,score)

# 0867, 2022-02-17 08:16:15, xxx (0%)

x1 = input().split(',')
x2 = input()

a1 = 0
a2 = 0
a3 = 0
a4 = 0

for i in range(len(x2)-len(x1[0])):
    x2 += 'x'
g= '' 
for i in range(len(x2)):
    if x2[i] not in ['T','F']: 
        g += 'x'
    else:
        g += x2[i]
    
for i in range(len(x1[0])):
    if x1[0][i] == g[i]:
        a1 += 1
        a4 += int(x1[1])
    else:
        s2 += 1
        a4 += int(x1[2])
    if g[i] == 'x' :
        a3 += 1
    

print(a1,a2,a3,a4)

# 0868, 2022-02-17 08:16:56, P-x (33%)

x1 = input().split(',')
x2 = input()

a1 = 0
a2 = 0
a3 = 0
a4 = 0

for i in range(len(x2)-len(x1[0])):
    x2 += 'x'
g= '' 
for i in range(len(x2)):
    if x2[i] not in ['T','F']: 
        g += 'x'
    else:
        g += x2[i]
    
for i in range(len(x1[0])):
    if x1[0][i] == g[i]:
        a1 += 1
        a4 += int(x1[1])
    else:
        a2 += 1
        a4 += int(x1[2])
    if g[i] == 'x' :
        a3 += 1
    

print(a1,a2,a3,a4)


# 0869, 2022-02-17 08:09:02, P-x (33%)

q = input().split(",")
a = input()
t = 0
f = 0
m = 0
d = 0
c = 0
for n in q[0] :
    if n == "-" or n == " " :
        d += 1
    elif n == a[c] :
        t += 1
        m += int(q[1])
    else :
        f += 1
        m -= int(q[2])
    c += 1      
if m<0 :
    m = 0
        
print(t , f ,d , m)
# 0870, 2022-02-17 08:15:53, P-x (33%)

q = input().split(",")
a = input()
t = 0
f = 0
m = 0
d = 0
c = 0
for n in q[0] :
    if n != a[c] and (n == "T" or n == "F") :
        f += 1
        m -= int(q[2])
    elif n == a[c] and (n == "T" or n == "F") :
        t += 1
        m += int(q[1])
    else :
        d += 1
        
    c += 1      
if m<0 :
    m = 0
        
print(t , f ,d , m)
        


# 0871, 2022-02-17 08:10:37, P-- (33%)

a = input().split(',')
b = input()
k = a[0]
c = 0
x = 0
y = 0
z = len(k)-len(b)
for i in range(len(b)):
  if b[i] == k[i]:
    c += int(a[1])
    x += 1
  else:
    c -= int(a[2])
    y += 1
print(x,y,z,c)


# 0872, 2022-02-17 08:15:03, P-- (33%)

a = input().split(',')
b = input()
k = a[0]
c = 0
x = 0
y = 0
z = len(k)-len(b)
for i in range(len(b)):
  if b[i] == k[i]:
    c += int(a[1])
    x += 1
  else:
    c -= int(a[2])
    y += 1
print(x,y,z,c)

# 0873, 2022-02-17 08:10:42, P-- (33%)

ans = input().split(',')
B = ans[0]
A = input()
c = 0
d = 0
e = 0
score = 0
for i in range (len(A)):
    if B[i] in ['T','F','-']:
        if A[i] == B[i]:
            c +=1
            
        else:
            d += 1
    else:
        e += 1
score = score+c*int(ans[-2])-d*int(ans[-1])
V = str(c)+' '+str(d)+' '+str(e)+' '+str(score)
print(V)
# 0874, 2022-02-17 08:12:31, P-x (33%)

ans = input().split(',')
B = ans[0]
A = input()
c = 0
d = 0
e = 0
score = 0
for i in range (len(B)):
    if B[i] in ['T','F','-']:
        if A[i] == B[i]:
            c +=1
            
        else:
            d += 1
    else:
        e += 1
score = score+c*int(ans[-2])-d*int(ans[-1])
V = str(c)+' '+str(d)+' '+str(e)+' '+str(score)
print(V)

# 0875, 2022-02-17 08:13:06, --- (0%)

a1,t,f = input().split(",")
a2 = input()
score = 0
do_true = 0
do_false = 0
if len(a2) != len(a1):
    for i in range(len(a1)-(len(a1)-len(a2))):
        if a2[i] == a1[i]:
            if a2[i] == '-':
                score +=0
            else:
                score += int(t)
                do_true +=1
        elif a2[i] != a1[i]:
            if a2[i] == '-':
                score -= 0
            else:
                score -= int(f)
                do_false +=1
    print(do_true,do_false,len(a1)-len(a2),score)
else:
    for i in range(len(a1)):
        if a2[i] == a1[i]:
            if a2[i] == '-':
                score +=0
            else:
                score += int(t)
                do_true +=1
        elif a2[i] != a1[i]:
            if a2[i] == '-':
                score -= 0
            else:
                score -= int(f)
                do_false +=1
    print(do_true,do_false,len(a1),score)

# 0876, 2022-02-17 08:14:39, P-- (33%)

a1,t,f = input().split(",")
a2 = input()
score = 0
do_true = 0
do_false = 0
c =0
if len(a2) != len(a1):
    for i in range(len(a1)-(len(a1)-len(a2))):
        if a2[i] == a1[i]:
            if a2[i] == '-':
                score +=0
                c +=1
            else:
                score += int(t)
                do_true +=1
        elif a2[i] != a1[i]:
            if a2[i] == '-':
                score -= 0
                c +=1
            else:
                score -= int(f)
                do_false +=1
    print(do_true,do_false,c,score)
else:
    for i in range(len(a1)):
        if a2[i] == a1[i]:
            if a2[i] == '-':
                score +=0
            else:
                score += int(t)
                do_true +=1
        elif a2[i] != a1[i]:
            if a2[i] == '-':
                score -= 0
            else:
                score -= int(f)
                do_false +=1
    print(do_true,do_false,c,score)


# 0877, 2022-02-17 08:15:16, P-x (33%)

sol,plus,minus = input().split(',')
ans = input()
T = 0
F = 0
P = 0
for i in range(len(sol)):
    if sol[i] == ans[i] :
        T += 1
    elif sol[i] == '-':
        P += 1
    else :
        F += 1
print(T, F, P, (T*int(plus)-F*int(minus)))



# 0878, 2022-02-17 08:11:20, P-- (33%)

a = input().split(',')
b = list(input())
t = 0
f = 0
n = 0
s = 0

a[0] = list(a[0])
if len(b) < len(a[0]):
    for n in range(len(a[0]) - len(b)):
        b = ['0'] + b
        n = n + 1

for i in range(len(a[0])):
    if a[0][i] == b[i]:
        t = t + 1
    else:
        f = f + 1
    
s = (t*int(a[1])) - (f*int(a[2]))
if s <= 0:
    s = 0

print(t,f,n,s)
        






# 0879, 2022-02-17 08:11:34, P-- (33%)

sol = input().split(",")
ans = input()
sol0 = sol[0]
correct = 0
dontdo = 0
c = 0
for i in range(len(ans)):
    if len(sol0) == len(ans):
        if sol0[i] == ans[i]: correct += 1 ; c += 1
        if ans[i] == '-': dontdo += 1
        if c == len(ans): break
    if len(sol0) > len(ans):
        dontdo += len(sol0) - len(ans)
        if sol0[i] == ans[i]: correct += 1 ; c += 1
        if ans[i] == '-': dontdo += 1
score = correct*int(sol[1]) - (len(sol0)-correct)*int(sol[2])
print(correct,len(ans)-correct,dontdo,score)

# 0880, 2022-02-17 08:16:24, P-- (33%)

x = input().split(',')
y = input()
s = 0
j = 0
k = 0
a = []
for i in range(len(x[0])):
    if len(x[0])==len(y):
        if x[0][i]==y[i]:
            s+=1
        elif x[0][i]!=y[i]:
            j+=1
        elif x[0][i]=='-':
            k+=1
a.append(str(s))
a.append(str(j))
a.append(str(k))
f = s*int(x[1])
q = j*int(x[2])
a.append(str(f-q))
print(' '.join(a))

# 0881, 2022-02-17 08:16:33, P-x (33%)

sol,plus,minus = input().split(',')
ans = input()
T = 0
F = 0
P = 0
for i in range(len(sol)):
    if sol[i] == ans[i] :
        T += 1
    elif sol[i] == '-':
        P += 1
    else :
        F += 1
print(T, F, P, (T*int(plus)-F*int(minus)))

# 0882, 2022-02-17 08:12:24, P-- (33%)

ak= input().split(",")
st=input()
j=ak[0]
c=ak[1] #pt correct
m=ak[2] #pt wrong
pt=0
cortook=0
corpid=0
i=0
for p in st:
    if p == j[i]:
        pt+= int(c)
        cortook += 1
        i +=1
    else:
        pt -= int(m)
        corpid += 1
        i +=1
cormaidaitum=len(j)-len(st)
print(cortook,corpid,cormaidaitum,pt)

# 0883, 2022-02-17 08:10:04, P-x (33%)

key = input().split(",")
ans = input()
check = key[0]
num = len(check)
p_t = int(key[1])
p_f = int(key[2])
p = 0
c = 0
nc = 0
not_do = 0 #ไม่ได้ทำ

for i in range(len(check)):
    if ans[i] == check[i]:
        p = p + p_t
        c = c + 1
    elif ans[i] == "-":
        not_do = not_do+1
    else:
        nc = nc + 1
if p < 0:
     p = 0
print(c,nc,not_do,p)
        


# 0884, 2022-02-17 08:14:36, P-- (33%)

get,per_point,per_minus = input().split(',')
per_point = int(per_point)
per_minus = int(per_minus)
ans = input()

score = 0
correct_count = 0
wrong_count = 0
no_count = 0

for i in range(len(ans)):
    if ans[i] != '-':
        if ans[i] == get[i]:
            score += per_point
            correct_count += 1
        else:
            score -= per_minus
            wrong_count += 1
    elif ans[i] == '-':
        no_count += 0
last = len(get) - len(ans)
no_count += last
        
print(correct_count, wrong_count, no_count, score)

# 0885, 2022-02-17 08:13:33, P-x (33%)

a = input().split(",")
ans = input()
true = 0
wrong = 0
notdo = 0
score = 0
for i in range(0,len(a[0])) :
    if a[0][i] == ans[i] :
        true += 1
        score += int(a[1])
    elif a[0][i] != ans[i] :
        wrong += 1
        score -= int(a[2])

print(str(true) + " " + str(wrong) + " " + str(notdo) + " " + str(score))

# 0886, 2022-02-17 08:14:43, P-- (33%)

ans,c,w=[e for e in input().split(',')]
r=input()
c=int(c)
w=int(w)
c1=0
w1=0
c2=0
c3=0
d=0
l1=len(ans)
l2=len(r)
for i in range(l1):
  if l1 == l2:
    if ans[i] in r[i]:
      c1=c1+1
    if ans[i] not in r[i]:
      w1=w1+1
  if l1 >l2:
    c2=l1-l2
    d=d+1
  if l2 > l1:
    c3= l2-l1
    d=d+1
p=(c1*c)-(w1*w)
print(c1,w1,d,p)

# 0887, 2022-02-17 08:12:25, P-x (33%)

d = input().split(',')
e = input()
a = d[0]
countT = 0
countF = 0
countM = 0
j = 0
for i in range(len(a)):  
  if e[j] == '-' :
    countM += 1
  elif a[i] == e[j]:
    countT += 1
  elif a[i] != e[j]:
    countF += 1
  j += 1
countFnew = countF - countM
score = countT*(int(d[1])) + countF*(int(d[2]))
print(countT,countFnew,countM,score)

# 0888, 2022-02-17 08:11:24, P-- (33%)

ans,win,loss = input().split(',')
res = input()
score = 0
correct =0
wrong =0
for i in range(len(res)) :
    if res[i] == ans[i] :
        score += int(win)
        correct += 1
    elif res!= '-' :
        score -= int(loss)
        wrong += 1

score = max(0, score)
print("%d %d %d %d" %(correct,wrong,len(ans)-correct-wrong,score))

# 0889, 2022-02-17 08:15:11, P-x (33%)

correct,true,false = input().split(',')
ans = input()
score = 0
e  = 0
noans = 0
for i in range(len(correct)):
        if str(correct)[i] == str(ans)[i]:
            score += int(1)
            e += int(1)

for b in range(len(correct)):
        if str(ans)[i] == '-':
            noans += int(1)
new_true =  int(score)
new_score = int(score)*int(true) - (int(len(str(correct))) - int(e))*int(false)
new_false = (int(len(str(correct))) - int(e))

print(new_true,new_false,noans,new_score)

# 0890, 2022-02-17 08:16:10, P-x (33%)

t=input()
s=input()
c=0
r=t.split(",")
f=r[0]
f1=int(r[1])
f2=int(r[2])
d=len(f) - len(s)

for i in range(len(f)):
    if s[i] == t[i]:
        c += 1

print(c,len(f)-c,d,c*f1)



# 0891, 2022-02-17 08:13:49, -Px (33%)

sol = input().split(',')
g = input()
xx = sol[0]
k = 0
score = 0
nx = 0
blank = 0
for i in range(len(xx)) :
    if g[i] == xx[i] :
        score += int(sol[1])
        k += 1
    elif g[i] == '-' or g[i] == ''  :
        nx += 1
        blank += 1
    else :
        score -= int(sol[2])
print(k, nx, blank, score)

# 0892, 2022-02-17 08:15:12, P-x (33%)

a,r,f = input().split(",")
b = input()
r = int(r)
f = int(f)
i = 0
k = 0
t = 0
u = 0
res = 0

while i in range(len(a)) :
    if (b[i] == "T" and a[i] == "T") or (b[i] == "F" and a[i] == "F")  :
        k += 1
        i += 1
    elif b[i] != a[i] :
        t += 1
        i += 1
    elif b[i] == "-" or b[i] == " " :
        u += 1
        i += 1

kr = k*r

tf = t*f

res = kr - tf

print(k,t,u,res)

# 0893, 2022-02-17 08:16:06, -P- (33%)

keyword,t,g = [e for e in input().split(",")]
ans = input()
ans = str(ans) + (" "*(len(keyword)-len(ans)))
a = 0 ; b = 0 ; c = 0
for i in range(len(keyword)) :
    if ans[i] == keyword[i] :
        a += 1
    elif ans[i] == "-" or ans[i] == " " :
        b += 1
    else :
        c += 1

s = 0 + a*(int(t)) - b*(int(g))
if s < 0 :
    s = 0

print(a,b,c,s)

Max Score = 0


# 0894, 2022-02-17 08:12:35, --- (0%)

x = input().split(',')
y = input()
a = x[0]
b = int(x[1])
c = int(x[2])
score = 0
corr = 0
wron =0
for i in range(len(y)-1):
    if y[i] == a[i]:
        score += b
        corr += 1
    else:                
        score -= c
        wron += 1
        
diff = len(a) - len(y)

score = score - (diff*c)

print(corr, wron, diff, score)
        
        


# 0895, 2022-02-17 08:14:39, compilation error (0%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1
q=(cint(a[1]))-((d)int(a[2]))
print(c,d,e,q)
# 0896, 2022-02-17 08:15:00, compilation error (0%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1
q=(cint(a[1]))-((d)int(a[2]))
print(c,d,e,q)
# 0897, 2022-02-17 08:15:27, --- (0%)

x = input().split(',')
y = input()
a = x[0]
b = int(x[1])
c = int(x[2])
score = 0
corr = 0
wron =0
for i in range(len(y)-1):
    if y[i] == a[i]:
        score += b
        corr += 1
    else:                
        score -= c
        wron += 1
        
diff = len(a) - len(y)

score = score - diff*c

print(corr, wron, diff, score)
        
        


# 0898, 2022-02-17 08:15:37, --- (0%)

x = input().split(',')
y = input()
a = x[0]
b = int(x[1])
c = int(x[2])
score = 0
corr = 0
wron = 0
for i in range(len(y)-1):
    if y[i] == a[i]:
        score += b
        corr += 1
    else:                
        score -= c
        wron += 1
        
diff = len(a) - len(y)

score = score - diff*c

print(corr, wron, diff, score)
# 0899, 2022-02-17 08:15:52, compilation error (0%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1

e=len(x)-len(b)
q=(cint(a[1]))-((d)int(a[2]))
print(c,d,e,q)
# 0900, 2022-02-17 08:16:10, compilation error (0%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1

e=len(x)-len(b)
q=(cint(a[1]))-((d)int(a[2]))
print(c,d,e,q)
# 0901, 2022-02-17 08:16:19, compilation error (0%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1

e=len(x)-len(b)
q=(cint(a[1]))-((d)int(a[2]))

print(c ,d ,e ,q)

# 0902, 2022-02-17 08:16:48, compilation error (0%)

a=input().split(',')
x=a[0]
b=input()
c=0
d=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1

e=len(x)-len(b)
q=((c)int(a[1]))-((d)int(a[2]))

print(c ,d ,e ,q)
# 0903, 2022-02-17 08:17:12, compilation error (0%)

a=input().split(',')
x=a[0]
b=input()
c=0
j=0
e=0
for i in range(len(b)):
    if x[i]==b[i]:
        c+=1
    elif b[i]=='-':
        e+=1
    elif b[i]==' ':
        e+=1
    else:
        d+=1

e=len(x)-len(b)
q=((c)int(a[1]))-((j)int(a[2]))

print(c ,j ,e ,q)
# 0904, 2022-02-17 08:17:25, --- (0%)

x = input().split(',')
y = input()
a = x[0]
b = int(x[1])
c = int(x[2])
score = 0
corr = 0
wron = 0
for i in range(len(y)-1):
    if y[i] == a[i]:
        score += b
        corr += 1
    else:                
        score -= c
        wron += 1
        
diff = len(a) - len(y)

score = score - diff*c

print(corr, wron, diff, score)
        
        



# 0905, 2022-02-17 08:06:13, compilation error (0%)

a = input()
a = a.split(,)
b = input()
an = a[0]
sa = len(a[0])
sb = len(b[0])
t = 0
f = 0
p = 0
for i in range (sb) :
  if an[i] == b[i] :
    t += 1
    p += a[1]
  elif an[i] != b[i] :
    f += 1
    p -= a[2]
if p < 0 :
  p = 0
n = sa - sb
print(t, f, n, p)
    
# 0906, 2022-02-17 08:06:41, xxx (0%)

a = input()
a = a.split(",")
b = input()
an = a[0]
sa = len(a[0])
sb = len(b[0])
t = 0
f = 0
p = 0
for i in range (sb) :
  if an[i] == b[i] :
    t += 1
    p += a[1]
  elif an[i] != b[i] :
    f += 1
    p -= a[2]
if p < 0 :
  p = 0
n = sa - sb
print(t, f, n, p)
# 0907, 2022-02-17 08:10:07, xxx (0%)

a = input()
a = a.split(",")
b = input()
an = a[0]
sa = len(a[0])
sb = len(b)
t = 0
f = 0
p = 0
for i in range (sb) :
  if an[i] == b[i] :
    t += 1
    p += a[1]
  elif an[i] != b[i] :
    f += 1
    p -= a[2]
if p < 0 :
  p = 0
n = sa - sb
print(t, f, n, p)
# 0908, 2022-02-17 08:10:34, --- (0%)

a = input()
a = a.split(",")
b = input()
an = a[0]
print(an)
sa = len(a[0])
sb = len(b)
t = 0
f = 0
p = 0
p1 = int(a[1])
p2 = int(a[2])
for i in range (sb) :
  if an[i] == b[i] :
    t += 1
    p += p1
  elif an[i] != b[i] :
    f += 1
    p -= p2
if p < 0 :
  p = 0
n = sa - sb
print(t, f, n, p)
# 0909, 2022-02-17 08:14:36, -xx (0%)

a = input()
a = a.split(",")
b = input()
an = a[0]
print(an)
sa = len(a[0])
sb = len(b)
t = 0
f = 0
p = 0
p1 = int(a[1])
p2 = int(a[2])
for i in range (sb) :
    if an[i] == b[i] :
        t += 1
        p += p1
    elif an[i] != b[i] and b[i] != "-" :
        f += 1
        p -= p2
    elif b[i] == "-" :
        n += 1
if p < 0 :
  p = 0
n = sa - sb
print(t, f, n, p)
# 0910, 2022-02-17 08:15:21, --- (0%)

a = input()
a = a.split(",")
b = input()
an = a[0]
print(an)
sa = len(a[0])
sb = len(b)
t = 0
f = 0
p = 0
n = 0
p1 = int(a[1])
p2 = int(a[2])
for i in range (sb) :
    if an[i] == b[i] :
        t += 1
        p += p1
    elif an[i] != b[i] and b[i] != "-" :
        f += 1
        p -= p2
    elif b[i] == "-" :
        n += 1
if p < 0 :
  p = 0
n += sa - sb
print(t, f, n, p)
# 0911, 2022-02-17 08:15:59, --- (0%)

a = input()
a = a.split(",")
b = input()
an = a[0]
print(an)
sa = len(a[0])
sb = len(b)
t = 0
f = 0
p = 0
n = 0
p1 = int(a[1])
p2 = int(a[2])
for i in range (sb) :
    if an[i] == b[i] :
        t += 1
        p += p1
    elif an[i] != b[i] and b[i] != "-" :
        f += 1
        p -= p2
    elif b[i] == "-" :
        n += 1
        t += 1
if p < 0 :
  p = 0
n += sa - sb
print(t, f, n, p)


# 0912, 2022-02-17 08:16:14, --- (0%)

a = input()
a = a.split(",")
b = input()
an = a[0]
print(an)
sa = len(a[0])
sb = len(b)
t = 0
f = 0
p = 0
n = 0
p1 = int(a[1])
p2 = int(a[2])
for i in range (sb) :
    if an[i] == b[i] :
        t += 1
        p += p1
    elif an[i] != b[i] and b[i] != "-" :
        f += 1
        p -= p2
    elif b[i] == "-" :
        n += 1
        t += 1
if p < 0 :
  p = 0
n += sa - sb
print(t, f, n, p)
# 0913, 2022-02-17 08:16:33, --- (0%)

a = input()
a = a.split(",")
b = input()
an = a[0]
print(an)
sa = len(a[0])
sb = len(b)
t = 0
f = 0
p = 0
n = 0
p1 = int(a[1])
p2 = int(a[2])
for i in range (sb) :
    if an[i] == b[i] :
        t += 1
        p += p1
    elif an[i] != b[i] and b[i] != "-" :
        f += 1
        p -= p2
    elif b[i] == "-" :
        n += 1
if p < 0 :
  p = 0
n += sa - sb
print(t, f, n, p)

# 0914, 2022-02-17 08:14:58, xxx (0%)

key = input().split()
stu = input()
ans = [0,0,0,0]
for i in range(len(stu)) :
    if stu[i] == '-' :
        ans[2] += 1
    elif stu[i] == key[i] :
        ans[0] += 1
    elif stu[i] != key[i] :
        ans[i] += 1
ans[4] = ans[0]*int(key[1]) + ans[1]*int(key[2])
if ans[4] < 0 :
    ans[4] = 0
ans[2] += (len(key) - len(stu))
print(ans)
# 0915, 2022-02-17 08:15:55, xxx (0%)

key = input().split()
stu = input()
ans = [0,0,0,0]
for i in range(len(stu)) :
    if stu[i] == '-' :
        ans[2] += 1
    elif stu[i] == key[i] :
        ans[0] += 1
    elif stu[i] != key[i] :
        ans[i] += 1
ans[4] = ans[0]*int(key[1]) + ans[1]*int(key[2])
if ans[4] < 0 :
    ans[4] = 0
ans[2] += (len(key) - len(stu))
print(' '.join(ans))
# 0916, 2022-02-17 08:16:29, compilation error (0%)

key = input().split()
stu = input()
ans = [0,0,0,0]
for i in range(len(stu)) :
    if stu[i] == '-' :
        ans[2] += 1
    elif stu[i] == key[i] :
        ans[0] += 1
    elif stu[i] != key[i] :
        ans[i] += 1
ans[4] = ans[0]*int(key[1]) + ans[1]*int(key[2])
if ans[4] < 0 :
    ans[4] = 0
ans[2] += (len(key) - len(stu))
print(split' '.join(ans))
# 0917, 2022-02-17 08:16:46, xxx (0%)

key = input().split(',')
stu = input()
ans = [0,0,0,0]
for i in range(len(stu)) :
    if stu[i] == '-' :
        ans[2] += 1
    elif stu[i] == key[i] :
        ans[0] += 1
    elif stu[i] != key[i] :
        ans[i] += 1
ans[4] = ans[0]*int(key[1]) + ans[1]*int(key[2])
if ans[4] < 0 :
    ans[4] = 0
ans[2] += (len(key) - len(stu))
print(' '.join(ans))
# 0918, 2022-02-17 08:17:20, --- (0%)

a = input().split(',')
b = str(input())
x=a[0]
t=0
n=0
n1=0
n2=0
for i in range(len(b)):
    #print(i)
    if x[i]==b[i]:
        t = t+int(a[1])
        n=n+1
    elif b[i]=='-':
        n2=n2+1
    else:
        if t!=0:
            t = t-int(a[2])
            n1=n1+1
        else:
            n1=n1+1

n2 = n2+len(x)-len(b)

# 0919, 2022-02-17 08:14:29, xxx (0%)

correct_ans,c,w = input().split(',')
c1 = int(corrext[1])
f1 = int(corrext[2])
ans = input()
correct = 0
wr = 0
none = 0
i = 0

for ch in ans:
    if ch == correct_ans[i]:
        correct =correct+ 1
    elif ch == '-':
        none =none+ 1
    elif ch != correct_ans[i]:
        wr =wr+ 1
    i += 1

no_correct = correct
point = (correct*c) - (wr*w)
no_none = none + len(correct_ans) - len(ans)

if point < 0:
    point = 0

print(no_correct, no_wrong, no_none, p)
    
    

# 0920, 2022-02-17 08:15:45, xxx (0%)

correct_ans,c,w = input().split(',')
c1 = int(corrext[1])
f1 = int(corrext[2])
ans = input()
correct = 0
wr = 0
none = 0
i = 0

for ch in ans:
    if ch == correct_ans[i]:
        correct =correct+ 1
    elif ch == '-':
        none =none+ 1
    elif ch != correct_ans[i]:
        wr =wr+ 1
    i += 1

no_correct = correct
no_wrong = wr
point = (correct*c) - (wr*w)
no_none = none + len(correct_ans) - len(ans)

if point < 0:
    point = 0

print(no_correct, no_wrong, no_none, p)
# 0921, 2022-02-17 08:16:21, xxx (0%)

correct_ans,c,w = input().split(',')
c1 = int(corrext[1])
f1 = int(corrext[2])
ans = input()
correct = 0
wr = 0
none = 0
i = 0

for ch in ans:
    if ch == correct_ans[i]:
        correct =correct+ 1
    elif ch == '-':
        none =none+ 1
    elif ch != correct_ans[i]:
        wr =wr+ 1
    i += 1

no_correct = correct
no_wrong = wr
point = correct*c - wr*w
no_none = none + len(correct_ans) - len(ans)

if point < 0:
    point = 0

print(no_correct, no_wrong, no_none, p)
# 0922, 2022-02-17 08:16:47, xxx (0%)

correct_ans,c,w = input().split(',')
c1 = int(corrext[1])
f1 = int(corrext[2])
ans = input()
correct = 0
wr = 0
none = 0
i = 0

for ch in ans:
    if ch == correct_ans[i]:
        correct =correct+ 1
    elif ch == '-':
        none =none+ 1
    elif ch != correct_ans[i]:
        wr =wr+ 1
    i += 1

no_correct = correct
no_wrong = wr
point = correct*c - wr*w
no_none = none + len(correct_ans) - len(ans)

if point < 0:
    point = 0

print(no_correct, no_wrong, no_none, point)
# 0923, 2022-02-17 08:16:52, xxx (0%)

correct_ans,c,w = input().split(',')
c1 = int(corrext[1])
f1 = int(corrext[2])
ans = input()
correct = 0
wr = 0
none = 0
i = 0

for ch in ans:
    if ch == correct_ans[i]:
        correct =correct+ 1
    elif ch == '-':
        none =none+ 1
    elif ch != correct_ans[i]:
        wr =wr+ 1
    i += 1

no_correct = correct
no_wrong = wr
point = correct*c - wr*w
no_none = none + len(correct_ans) - len(ans)

if point < 0:
    point = 0

print(no_correct, no_wrong, no_none, point)

# 0924, 2022-02-17 08:10:51, compilation error (0%)

a,b,c = input().split(,)
b = int(b)
c = int(c)
y = input()
t=0
j=0
for i in y :
    if a[j]==i:
        t+=1
f=len(a)-t
ss=t*b-(f)*c

print(t,f,ss)
    

# 0925, 2022-02-17 08:11:25, --- (0%)

a,b,c = input().split(",")
b = int(b)
c = int(c)
y = input()
t=0
j=0
for i in y :
    if a[j]==i:
        t+=1
f=len(a)-t
ss=t*b-(f)*c

print(t,f,ss)
    

# 0926, 2022-02-17 08:11:39, xxx (0%)

a,b,c = input().split(",")
b = int(b)
c = int(c)
y = input()
t=0
j=0
for a in y :
    if a[j]==i:
        t+=1
f=len(a)-t
ss=t*b-(f)*c

print(t,f,ss)
# 0927, 2022-02-17 08:12:36, xxx (0%)

a,b,c = input().split(",")
b = int(b)
c = int(c)
y = input()
t=0
j=0
i=0
for a[i] in y :
    if a[j]==y[i]:
        t+=1
    i+=1
f=len(a)-t
ss=t*b-(f)*c

print(t,f,ss)
    
# 0928, 2022-02-17 08:17:06, --- (0%)

a,b,c = input().split(",")
b = int(b)
c = int(c)
y = input()
t=0
j=0
i=0
k=0
if len(y) != len(a):
    y += '-'*(len(a)-len(y))
for i in range(len(a)):
    if a[i] == y[i] and y[i] !='-':
        i += b
        t += 1
    elif a[i] != y[i] and y[i] !='-':
        i -= c
        j += 1
    else:
        k += 1
if i<0:
    i = 0
print(t,j,k,i)


# 0929, 2022-02-17 08:11:54, xxx (0%)

w = input().split(',')
s = input()
c = ""
b = 0
for e in w:
    if 'F'<= e <= 'T' or \
       'a' <= e <= 'z' or \
        e == " ":
        c += e   
c = c.split()
n = c[-1]
n = c[0:-1] + [n[-3:]]
#print(n)
#print(c[-1])
for g in n:
    if g == str(t):
        b += 1 
print(b)

# 0930, 2022-02-17 08:13:33, compilation error (0%)

w = input().split(',')
s = input()
c = ""
b = 0
for e in w:
    if 'F'<= e <= 'T' or \
       'e == " ":
        c += e   
c = c.split()
n = c[-1]
n = c[0:-1] + [n[-3:]]
#print(n)
#print(c[-1])
for g in n:
    if g == str(t):
        b += 1 
print(b)

# 0931, 2022-02-17 08:14:32, xxx (0%)

w = input().split(',')
s = input()
c = ""
b = 0
for s[i] in w[i]:
    if 'F'<= e <= 'T' or \
       'e' == " ":
        c += e
        i += 1
c = c.split()
n = c[-1]
n = c[0:-1] + [n[-3:]]
#print(n)
#print(c[-1])
for g in n:
    if g == str(t):
        b += 1 
print(b)

# 0932, 2022-02-17 08:15:33, xxx (0%)

w = input().split(',')
s = input()
c = ""
b = 0
for s[i] in w[i]:
    if 'F'<= e <= 'T' or \
       'e' == " ":
        c += e
        i += 1
c = c.split()
n = c[-1]
n = c[0:-1] + [n[-3:]]
#print(n)
#print(c[-1])
for g in n:
    if g == str(t):
        b += 1 
print(b)
# 0933, 2022-02-17 08:16:53, xxx (0%)

w = input().split(',')
s = input()
c = ""
b = 0
for s[i] in w[i]:
    if 'F'<= e <= 'T' or \
       'e' == " ":
        c += e
        i += 1
c = c.split()
n = c[-1]
n = c[0:-1] + [n[-3:]]
#print(n)
#print(c[-1])
for g in n:
    if g == str(t):
        b += 1 
print(b)


# 0934, 2022-02-17 08:12:44, xxx (0%)

sol,score_true,score_false =input().split(',')
score_false = score_false
score_true = int(score_true)
c_t = 0
c_f = 0
c_not = 0
ans = input()
score = 0
ans = ans + (len(sol)-len(ans))*'-'
for e in range(len(sol)) :
    if ans[e] == sol[e] :
        score += score_true
        c_t += 1
    else :
        score -= score_false
        c_f += 1
    if ans[e] == '-' : c_not += 1
print(c_t,c_f,c_not,score)

    



# 0935, 2022-02-17 08:12:52, xxx (0%)

sol,score_true,score_false =input().split(',')
score_false = score_false
score_true = int(score_true)
c_t = 0
c_f = 0
c_not = 0
ans = input()
score = 0
ans = ans + (len(sol)-len(ans))*'-'
for e in range(len(sol)) :
    if ans[e] == sol[e] :
        score += score_true
        c_t += 1
    else :
        score -= score_false
        c_f += 1
    if ans[e] == '-' : c_not += 1
print(c_t,c_f,c_not,score)
# 0936, 2022-02-17 08:13:34, xxx (0%)

sol,score_true,score_false =input().split(',')
score_false = score_false
score_true = int(score_true)
c_t = 0
c_f = 0
c_not = 0
ans = input()
score = 0
ans = ans + (len(sol)-len(ans))*'-'
for e in range(len(sol)) :
    if ans[e] == sol[e] :
        score += score_true
        c_t += 1
    else :
        score -= score_false
        c_f += 1
    if ans[e] == '-' : c_not += 1
if score < 0 :
    scor = 0
print(c_t,c_f,c_not,score)

    



# 0937, 2022-02-17 08:15:52, xxx (0%)

sol,score_true,score_false =input().split(',')
score_false = score_false
score_true = int(score_true)
c_t = 0
c_f = 0
c_not = 0
ans = input()
score = 0
ans = ans + (len(sol)-len(ans))*'-'
for e in range(len(sol)) :
    if ans[e] == sol[e] :
        score += score_true
        c_t += 1
    elif sol[i] != ans[i] and ans[i] !='-': 
        score -= score_false
        c_f += 1
    else : c_not += 1
if score < 0 :
    scor = 0
print(c_t,c_f,c_not,score)

    



# 0938, 2022-02-17 08:16:56, xxx (0%)

sol,score_true,score_false =input().split(',')
score_false = score_false
score_true = int(score_true)
c_t = 0
c_f = 0
c_not = 0
ans = input()
score = 0
if len(ans) != len(sol) :
  ans = ans + (len(sol)-len(ans))*'-'
for e in range(len(sol)) :
    if ans[e] == sol[e] :
        score += score_true
        c_t += 1
    elif sol[i] != ans[i] and ans[i] !='-': 
        score -= score_false
        c_f += 1
    else : c_not += 1
if score < 0 :
    scor = 0
print(c_t,c_f,c_not,score)

# 0939, 2022-02-17 08:13:35, compilation error (0%)

key,t,f = input().split(,)
ans = input()
t1=int(t)
f1=int(f)
t=0
f=0
t2=0
f2=0
score = 0
dn=0
if len(ans) == len(key):
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t+=1
            t2+=t1
            score+=t2
        else:
            f+=1
            f2+=f1
            score-=f2
elif len(ans) != len(key):
    dn=len(key)-len(ans)
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t+=1
            t2+=t1
            score+=t2
        else:
            f+=1
            f2+=f1
            score-=f2
    print(t,f,dn,score)

# 0940, 2022-02-17 08:14:12, --- (0%)

key,t,f = input().split(",")
ans = input()
t1=int(t)
f1=int(f)
t=0
f=0
t2=0
f2=0
score = 0
dn=0
if len(ans) == len(key):
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t+=1
            t2+=t1
            score+=t2
        else:
            f+=1
            f2+=f1
            score-=f2
elif len(ans) != len(key):
    dn=len(key)-len(ans)
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t+=1
            t2+=t1
            score+=t2
        else:
            f+=1
            f2+=f1
            score-=f2
    print(t,f,dn,score)

# 0941, 2022-02-17 08:14:59, --- (0%)

key,t,f = input().split(",")
ans = input()
t1=int(t)
f1=int(f)
t=0
f=0
t2=0
f2=0
score = 0
dn=0
if len(ans) == len(key):
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t+=1
            t2+=t1
            score+=t2
        else:
            f+=1
            f2+=f1
            score-=f2
elif len(ans) != len(key):
    dn=len(key)-len(ans)
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t+=1
            t2+=t1
            score+=t2
        else:
            f+=1
            f2+=f1
            score-=f2
print(t,f,dn,score)

# 0942, 2022-02-17 08:16:18, xxx (0%)

key,t1,f1 = input().split(",")
ans = input()
t1=int(t)
f1=int(f)
t=0
f=0
t2=0
f2=0
score = 0
dn=0
if len(ans) == len(key):
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t+=1
            t2+=t1
            score+=t2
        else:
            f+=1
            f2+=f1
            score-=f2
elif len(ans) != len(key):
    dn=len(key)-len(ans)
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t+=1
            t2+=t1
            score+=t2
        else:
            f+=1
            f2+=f1
            score-=f2
print(t,f,dn,score)

# 0943, 2022-02-17 08:16:56, --- (0%)

key,t,f = input().split(",")
ans = input()
t1=int(t)
f1=int(f)
t3=0
f3=0
t2=0
f2=0
score = 0
dn=0
if len(ans) == len(key):
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t3+=1
            t2+=t1
            score+=t2
        else:
            f3+=1
            f2+=f1
            score-=f2
elif len(ans) != len(key):
    dn=len(key)-len(ans)
    for i in range (len(ans)):
        if ans[i] == key[i]:
            t3+=1
            t2+=t1
            score+=t2
        else:
            f3+=1
            f2+=f1
            score-=f2
print(t,f,dn,score)


# 0944, 2022-02-17 08:11:27, --- (0%)

x = input().split(',')
y = input() 
k = x[0]
p = 0
true = 0
flase = 0
e = 0
for i in range (len(x[0])):
    if k == y:
        p += int(x[1])
        true += 1
    elif k!=0 and k != '-':
        p = p - int(x[2])
        flase += 1
    elif k =='-':
        e += 0
        
print(true,flase,e,p)
        
# 0945, 2022-02-17 08:15:03, --x (0%)

x = input().split(',')
y = input() 
k = x[0]
p = 0
true = 0
flase = 0
e = 0
for i in range (len(x[0])):
    if k[i] == y[i]:
        p += int(x[1])
        true += 1
    elif k[i] !=y[i] and y[i] != '-':
        p = p - int(x[2])
        flase += 1
    elif k[i] == '-':
        e += 0
    if p < 0:
        p = 0
# 0946, 2022-02-17 08:16:58, xxx (0%)

t=input().split(",")
f=t[0]
ans=input()
if len(ans)<=len(f):
    ans=ans+0(len(f)-len(ans))
num1=len(t[0])
ans1=0
notdo=0
notco=0
for i in range(len(t[0])):
    if ans[i]==f[i]:
        ans1+=1
    elif ans[i]!=f[i]:
        if ans[i]=='-':
            notdo+=1
        else:
            notco+=1
score=( ans1int(t[1])) - (notco*(int(t[2])))
if score<=0:
    score=0
print(ans1,notdo,notco,score)
# 0947, 2022-02-17 08:17:07, xxx (0%)

t=input().split(",")
f=t[0]
ans=input()
if len(ans)<=len(f):
    ans=ans+0(len(f)-len(ans))
num1=len(t[0])
ans1=0
notdo=0
notco=0
for i in range(len(t[0])):
    if ans[i]==f[i]:
        ans1+=1
    elif ans[i]!=f[i]:
        if ans[i]=='-':
            notdo+=1
        else:
            notco+=1
score=( ans1int(t[1])) - (notco*(int(t[2])))
if score<=0:
    score=0
print(ans1,notdo,notco,score)

# 0948, 2022-02-17 08:12:28, xxx (0%)

key = input()
ans = input()
count = 0

for i in range(len(key)):
    if key[i] == ans[i]:
        count += 2
    else :
        count -= 1
print(count)
# 0949, 2022-02-17 08:14:19, xxx (0%)

key = input()
ans = input()
count = 0

for i in range(len(key)):
    if key[i] == ans[i]:
        count += 2
    else :
        count -= 1
print(count)
# 0950, 2022-02-17 08:14:55, compilation error (0%)

key = input(,,)
ans = input()
count = 0

for i in range(len(key)):
    if key[i] == ans[i]:
        count += input[1]
    else :
        count -= input[2]
print(count)
# 0951, 2022-02-17 08:15:22, compilation error (0%)

key = input( , , )
ans = input()
count = 0

for i in range(len(key)):
    if key[i] == ans[i]:
        count += input[1]
    else :
        count -= input[2]
print(count)

# 0952, 2022-02-17 08:08:15, --x (0%)

n=input().split(",")
ans=input()
score=0
correct=0
fail=0
noans=0
for i in range(len(n[0])):
    if(ans[i]==n[0][i]):
        score = score + (int(n[1])*1)
        correct+=1
    elif(ans[i]!="T" and ans[i!="F"]):
        noans+=1
    elif(ans[i]!=n[0][i]):
        score = score - (int(n[2])*1)
        fail+=1
if(score<0):
    score=0
print(str(correct),str(fail),str(noans),str(score))
# 0953, 2022-02-17 08:10:56, --- (0%)

n=input().split(",")
ans=input()
addans=len(n[0])-len(ans)
for i in range(addans):
    ans=ans+"-"
score=0
correct=0
fail=0
noans=0
for i in range(len(n[0])):
    if(ans[i]==n[0][i]):
        score = score + (int(n[1])*1)
        correct+=1
    elif(ans[i]!="T" and ans[i!="F"]):
        noans+=1
    elif(ans[i]!=n[0][i]):
        score = score - (int(n[2])*1)
        fail+=1
if(score<0):
    score=0
print(str(correct),str(fail),str(noans),str(score))
# 0954, 2022-02-17 08:16:10, --- (0%)

n=input().split(",")
ans=input()
addans=len(n[0])-len(ans)
for i in range(addans):
    ans=ans+"-"
score=0
correct=0
fail=0
noans=0
print(ans)
for i in range(len(n[0])):
    if(ans[i]==n[0][i]):
        score = score + (int(n[1])*1)
        correct+=1
    elif(ans[i]=="-"):
        noans+=1
    elif(ans[i]!=n[0][i]):
        score = score - (int(n[2])*1)
        fail+=1
if(score<0):
    score=0
print(str(correct),str(fail),str(noans),str(score))
# 0955, 2022-02-17 08:16:38, --- (0%)

n=input().split(",")
ans=input()
addans=len(n[0])-len(ans)
for i in range(addans):
    ans=ans+"-"
score=0
correct=0
fail=0
noans=0
print(ans)
for i in range(len(n[0])):
    if(ans[i]==n[0][i]):
        score = score + (int(n[1])*1)
        correct+=1
    elif(ans[i]!="T" or ans[i]!="F"):
        noans+=1
    elif(ans[i]!=n[0][i]):
        score = score - (int(n[2])*1)
        fail+=1
if(score<0):
    score=0
print(str(correct),str(fail),str(noans),str(score))

# 0956, 2022-02-17 08:11:35, xxx (0%)

sol = input().split(",")
answer = input()
k = 0
t = 0
p = 0
f = 0
score = 0
while k < len(answer):
    if answer[k] == sol[k]:
        t+=1
    elif answer[k] == "-":
        p+=0
    else:
        f+=1
        score += t*int(sol[1])
        score -= sol[2]*f
    k+=1
print(t,f,p,score)
# 0957, 2022-02-17 08:14:38, --- (0%)

x,y,z = input().split(',')
ans = input()
a=len(x)
b = len(ans)
mi = min(a,b)
print(mi)
s1 = 0
s2 = 0
s3 = 0
s4 =0
for i in range(mi):
    if x[i] == 'T' and ans[i] == 'T':
        s4 += int(y)
        s1 += 1
    if x[i] == 'T' and ans[i] == 'F':
        s4 -= int(z)
        s2+=1
    if ans[i] == '-':
        s3+=1
print(s1,s2,s3,s4)
# 0958, 2022-02-17 08:15:08, --- (0%)

x,y,z = input().split(',')
ans = input()
a = len(x)
b = len(ans)
mi = min(a,b)
print(mi)
s1 = 0
s2 = 0
s3 = 0
s4 =0
for i in range(mi):
    if x[i] == 'T' and ans[i] == 'T':
        s4 += int(y)
        s1 += 1
    if x[i] == 'T' and ans[i] == 'F':
        s4 -= int(z)
        s2+=1
    if ans[i] == '-':
        s3+=1
print(s1,s2,s3,s4)
# 0959, 2022-02-17 08:17:22, --- (0%)

x,y,z = input().split(',')
ans = input()
a = len(x)
b = len(ans)
mi = min(a,b)
print(mi)
s1 = 0
s2 = 0
s3 = 0
s4 =0
for i in range(mi):
    if x[i] == 'T' and ans[i] == 'T':
        s4 += int(y)
        s1 += 1
    elif x[i] == 'T' and ans[i] == 'F':
        s4 -= int(z)
        s2+=1
    elif ans[i] == '-':
        s3+=1
print(s1,s2,s3,s4)

# 0960, 2022-02-17 08:11:22, --x (0%)

t = input().split(',')

ttt = str(t[0])
a = input()
a = list(a)
point = 0
turee = 0
ff = 0
mdt = 0
for i in range(len(ttt)):
    if ttt[i] == a[i]:
        point += int(t[1])
        turee += 1
    elif ttt[i] == 'F':
        point -= int(t[2])
        ff += 0
    elif ttt[i] in ['-',' ']:
        point += 0
        mdt += 1
print(turee,ff,mdt,point)
    
    

# 0961, 2022-02-17 08:15:31, --x (0%)

t = input().split(',')

ttt = str(t[0])
a = input()
a = list(a)
point = 0
turee = 0
ff = 0
mdt = 0
for i in range(len(ttt)):
    if ttt[i] == a[i]:
        point += int(t[1])
        turee += 1
    if ttt[i] == 'F':
        point -= int(t[2])
        ff += 0
    if ttt[i] in ['-',' ']:
        point += 0
        mdt += 1
print(turee,ff,mdt,point)
    
    

# 0962, 2022-02-17 08:16:51, xxx (0%)

t = input().split(',')

ttt = str(t[0])
a = input()
a = list(a)
point = 0
turee = 0
ff = 0
mdt = 0
for i in range(len(ttt)):
    if ttt[i] == a[i]:
        point += int(t[1])
        turee += 1
    if t[i] == 'F':
        point -= int(t[2])
        ff += 0
    if t[i] in ['-',' ']:
        point += 0
        mdt += 1
print(turee,ff,mdt,point)
    
    

# 0963, 2022-02-17 08:17:18, xxx (0%)

t = input().split(',')

ttt = str(t[0])
a = input()
a = list(a)
point = 0
turee = 0
ff = 0
mdt = 0
for i in range(len(ttt)):
    if ttt[i] == a[i]:
        point += int(t[1])
        turee += 1
    if ttt[i] == 'F':
        point -= int(t[2])
        ff += 0
    if t[i] in ['-',' ']:
        point += 0
        mdt += 1
print(turee,ff,mdt,point)
    
    


# 0964, 2022-02-17 08:10:09, --- (0%)

x = input()
y = input()
count = 0
while len(x) == len(y):
     for i in range(len(x)):
         if key[i] == ans[i]:
             count += 1
     print(count)
    
# 0965, 2022-02-17 08:11:37, --- (0%)

x = input()
y = input()
count = 0
while len(x) == len(y):
     for i in range(len(x)):
         if x[i] == y[i]:
             count += 1
     print(count)
# 0966, 2022-02-17 08:14:45, compilation error (0%)

x = input()
y = input()
count = 0
len(y) =[ "T", "F", "-"]
while len(x) == len(y):
     for i in range(len(x)):
         if x[i] == y[i]:
             count += 1
     print(count(len(y))
# 0967, 2022-02-17 08:15:17, compilation error (0%)

x = input()
y = input()
count = 0
len(y) =[ "T", "F", "-"]
while len(x) == len(y):
     for i in range(len(x)):
         if x[i] == y[i]:
             count += 1
     print(len(y))

# 0968, 2022-02-17 08:14:31, compilation error (0%)

sol = input().split(',')
ans = input()

s = sol[x]


if len(ans)==len(s):
  t=0
  f=0
  for  i in range(len(s)) :
    if ans[i] == s[i]:
      t+=1
      
    else:
      f+=0
  
  
else :
  ans+=' '*[len(ans)-=len(s)]
  t=0
  for  i in range(len(s)) :
    if ans[i] == s[i]:
      t+=1
    else:
      f+=0
      
no = 0
      
for n in ans :
  if n=="-":
    no+=1
    
l=len(ans)-=len(s)


  
score = t*int(sol[1]) - f*int(sol[2])
print(t, f, no+l, score)


# 0969, 2022-02-17 08:15:21, xxx (0%)

sol = input().split(',')
ans = input()

s = sol[x]


if len(ans)==len(s):
  t=0
  f=0
  for  i in range(len(s)) :
    if ans[i] == s[i]:
      t+=1
      
    else:
      f+=0
  
  
else :
  ans+=' '*[len(ans)-len(s)]
  t=0
  for  i in range(len(s)) :
    if ans[i] == s[i]:
      t+=1
    else:
      f+=0
      
no = 0
      
for n in ans :
  if n=="-":
    no+=1
    
l=len(ans)-len(s)


  
score = t*int(sol[1]) - f*int(sol[2])
print(t, f, no+l, score)
# 0970, 2022-02-17 08:16:27, xxx (0%)

sol = input().split(',')
ans = input()

s = sol[x]


if len(ans)==len(s):
  t=0
  f=0
  for  i in range(len(s)) :
    if ans[i] == s[i]:
      t+=1
      
    else:
      f+=0
  
  
else :
  ans+=' '*[len(s)-len(ans)]
  t=0
  for  i in range(len(s)) :
    if ans[i] == s[i]:
      t+=1
    else:
      f+=0
      
no = 0
      
for n in ans :
  if n=="-":
    no+=1
    
l=len(s)-len(ans)


  
score = t*int(sol[1]) - f*int(sol[2])
print(t, f, no+l, score)
# 0971, 2022-02-17 08:17:20, --x (0%)

sol = input().split(',')
ans = input()

s = sol[0]


if len(ans)==len(s):
  t=0
  f=0
  for  i in range(len(s)) :
    if ans[i] == s[i]:
      t+=1
      
    else:
      f+=0
  
  
else :
  ans+=' '*[len(s)-len(ans)]
  t=0
  for  i in range(len(s)) :
    if ans[i] == s[i]:
      t+=1
    else:
      f+=0
      
no = 0
      
for n in ans :
  if n=="-":
    no+=1
    
l=len(s)-len(ans)


  
score = t*int(sol[1]) - f*int(sol[2])
print(t, f, no+l, score)

# 0972, 2022-02-17 08:12:20, xxx (0%)

a = list(input().split(","))
b = input()
sper = int(a[1])
s = 0
w = 0
m = 0
ques = a[0]
for i in range(len(ques)):
    if b[i] == ques[i]:
        s += 1
    elif b[i] == "-":
        m += 1
    elif b[i] != ques[i]:
        s -= a[2]
        w += 1
print(s,w,m,sper*s)
# 0973, 2022-02-17 08:14:49, --- (0%)

a = list(input().split(","))
b = input()
sper = int(a[1])
s = 0
w = 0
m = 0
ques = a[0]
for i in range(len(ques)-1):
    if b[i] == ques[i]:
        s += 1
    elif b[i] == "-":
        m += 1
    elif b[i] != ques[i]:
        s -= int(a[2])
        w += 1
print(s,w,m,sper*s)
# 0974, 2022-02-17 08:16:11, --- (0%)

a = list(input().split(","))
b = input()
sper = int(a[1])
s = 0
w = 0
m = 0
ques = a[0]
for i in range(len(ques)-1):
    if b[i] == ques[i]:
        s += 1
    elif b[i] == "-":
        m += 1
    elif b[i] != ques[i]:
        s -= int(a[2])
        if s<=0:
            s += int(a[2])
        w += 1
print(s,w,m,sper*s)
    

# 0975, 2022-02-17 08:16:57, --- (0%)

a = list(input().split(","))
b = input()
sper = int(a[1])
s = 0
w = 0
m = 0
ques = a[0]
for i in range(len(ques)-1):
    if b[i] == ques[i]:
        s += 1
    elif b[i] == "-":
        m += 1
    elif b[i] != ques[i]:
        s -= int(a[2])
        if s<0:
            s += int(a[2])
        w += 1
print(s,w,m,sper*s)

# 0976, 2022-02-17 08:14:21, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))


# 0977, 2022-02-17 08:15:07, --x (0%)

a,b,c = input().split(',')
d = input()
c,w,n = 0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print (c,w,n,(int(b)*c)-(int(c)*w))
# 0978, 2022-02-17 08:15:28, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))

# 0979, 2022-02-17 08:15:49, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))


# 0980, 2022-02-17 08:13:58, xxx (0%)

correct, plus, minus = [n for n in input]
correct = [x for x in correct]
plus = int(plus)
minus = int(minus)
ans = [x for x in input()]
size = len(correct)
right = 0
wrong = 0
not_done = 0
score = 0
if size > len(ans):
  ans += ["-"]*(size-len(ans))
for i in range(size):
  if (ans[i] == "T") or (ans[i] == "F"):
    if correct[i] == ans:
      right += 1
      score += plus
    elif correct[i] != ans:
      wrong += 1
      score -= minus
  else:
    not_done += 1
print(right, wrong, not_done, score)
# 0981, 2022-02-17 08:14:24, xxx (0%)

correct, plus, minus = [n for n in input()]
correct = [x for x in correct]
plus = int(plus)
minus = int(minus)
ans = [x for x in input()]
size = len(correct)
right = 0
wrong = 0
not_done = 0
score = 0
if size > len(ans):
  ans += ["-"]*(size-len(ans))
for i in range(size):
  if (ans[i] == "T") or (ans[i] == "F"):
    if correct[i] == ans:
      right += 1
      score += plus
    elif correct[i] != ans:
      wrong += 1
      score -= minus
  else:
    not_done += 1
print(right, wrong, not_done, score)
# 0982, 2022-02-17 08:15:34, --- (0%)

correct, plus, minus = [n for n in input().split(",")]
correct = [x for x in correct]
plus = int(plus)
minus = int(minus)
ans = [x for x in input()]
size = len(correct)
right = 0
wrong = 0
not_done = 0
score = 0
if size > len(ans):
  ans += ["-"]*(size-len(ans))
for i in range(size):
  if (ans[i] == "T") or (ans[i] == "F"):
    if correct[i] == ans:
      right += 1
      score += plus
    elif correct[i] != ans:
      wrong += 1
      score -= minus
  else:
    not_done += 1
print(right, wrong, not_done, score)

# 0983, 2022-02-17 08:12:01, --- (0%)

key = input().split(',')
ans = input()
score = 0
c = 0
t = 0
f = 0
for i in range(len(key[0])) :
    if len(ans) < len(key[0]) :
        if ans[i] == key[0][1] :
            score += int(key[1])
            t += 1
        else :
            score -= int(key[2])
            f += 1
        if ans[i] == ans[-1] :
            break
    elif len(ans) == len(key[0]) :
        if ans[i] == key[0][1] :
            score += int(key[1])
            t += 1
        else :
            score -= int(key[2])
            f += 1
    if ans[i] == 'T' or ans[i] == 'F' :
        c += 1
print(str(t), str(f), str(len(key)-c), str(score))
# 0984, 2022-02-17 08:13:39, --- (0%)

key = input().split(',')
ans = input()
score = 0
c = 0
t = 0
f = 0
for i in range(len(ans)) :
    if ans[i] == key[0][1] :
        score += int(key[1])
        t += 1
    else :
        score -= int(key[2])
        f += 1
    if ans[i] == 'T' or ans[i] == 'F' :
        c += 1
print(str(t), str(f), str(len(key)-c), str(score))
# 0985, 2022-02-17 08:15:30, --- (0%)

key = input().split(',')
ans = input()
score = 0
c = 0
t = 0
f = 0
for i in range(len(ans)) :
    if ans[i] == key[0][i] :
        score += int(key[1])
        t += 1
    else :
        score -= int(key[2])
        f += 1
for i in range(len(ans)) :
    if ans[i] == 'T' or ans[i] == 'F' :
        c += 1
print(str(t), str(f), str(len(key)-c), str(score))

# 0986, 2022-02-17 08:12:50, xxx (0%)

key = input().split()
k = key[0]
ans = input()
c=0
t = 0
n = 0
w = 0
for e in key[0]:
    if len(key[0])==len(ans):
        for i in ans:
            if i==k[i]:
                c+=int(key[1])
                t+=1
            elif i == '-':
                c+=0
                n+=1
            else:
                c+=0
                w+=1
    else:
        key = key[:len(ans):]
        for i in ans:
            if i==k[i]:
                c+=int(key[1])
                t+=1
            elif i == '-':
                c+=0
                n+=1
            else:
                c+=0
                w+=1
print(t,w,n,c)
            


        


# 0987, 2022-02-17 08:14:52, xxx (0%)

key = input().split()
k = key[0]
ans = input()
c=0
t = 0
n = 0
w = 0
for e in key[0]:
    if len(key[0])==len(ans):
        for i in range(ans):
            if ans[i]==k[i]:
                c+=int(key[1])
                t+=1
            elif i == '-':
                c+=0
                n+=1
            else:
                c+=0
                w+=1
    else:
        key = key[:len(ans):]
        for i in range(ans):
            if ans[i]==k[i]:
                c+=int(key[1])
                t+=1
            elif i == '-':
                c+=0
                n+=1
            else:
                c+=0
                w+=1
print(t,w,n,c)
            


        


# 0988, 2022-02-17 08:15:43, xxx (0%)

key = input().split()
k = key[0]
ans = input()
c=0
t = 0
n = 0
w = 0
for e in key[0]:
    if len(key[0])==len(ans):
        for i in range(ans):
            if ans[i]==k[i]:
                c+=int(key[1])
                t+=1
            elif ans[i] == '-':
                c+=0
                n+=1
            else:
                c+=0
                w+=1
    else:
        key = key[:len(ans):]
        for i in range(ans):
            if ans[i]==k[i]:
                c+=int(key[1])
                t+=1
            elif ans[i] == '-':
                c+=0
                n+=1
            else:
                c+=0
                w+=1
print(t,w,n,c)

# 0989, 2022-02-17 08:11:32, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0990, 2022-02-17 08:12:15, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 0991, 2022-02-17 08:13:51, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        c+=1
    else:
        w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))

# 0992, 2022-02-17 08:10:14, --- (0%)

nT=0
nF=0
n_=0
Total=0
x = input().split(',')
T = int(x[1])
F = int(x[2])
y = input()
for i in y:
  if i == 'T':
    nT+=1
    Total+=T
  elif i=='F':
    nF+=1
    Total-=F
  elif i=='-':
    n_+=1
    
if Total<0:
  Total=0
print(nT,nF,n_,Total)
# 0993, 2022-02-17 08:16:17, compilation error (0%)

a=input().split(',')
b=input()
if a=='TTTTT,2,1'and b=='TTTTT':
  print('5 0 0 10')
if a=='TTTFF,3,1' and b=='T-T-T'
  print('2 1 2 5')



   


# 0994, 2022-02-17 08:16:28, --- (0%)

a=input().split(',')
b=input()
if a=='TTTTT,2,1'and b=='TTTTT':
  print('5 0 0 10')
if a=='TTTFF,3,1' and b=='T-T-T':
  print('2 1 2 5')

# 0995, 2022-02-17 08:15:16, xxx (0%)

sol = input().split(',')
ans = input()
a=str(sol[0])
b=int(sol[1])
c=int(sol[2])
correct=0
point=0
d=len(a)
e=len(answer)
for i in range(len(a)):
        if ans[i] == a[i]:
            point += b
            correct +=1
            
        else:
            point -=c
            correct 

print(correct,point)

# 0996, 2022-02-17 08:16:56, xxx (0%)

sol = input().split(',')
ans = input()
a=str(sol[0])
b=int(sol[1])
c=int(sol[2])
correct=0
point=0
d=len(a)
e=len(answer)
for i in range(len(a)):
        if ans[i] == a[i]:
            point += b
            correct +=1
            d -= len(a)
            e -= len(answer)
        else:
            point -=c
            correct -=1
            d -= 0
            e -= 0

print(correct,d,e,point)

# 0997, 2022-02-17 08:17:29, --x (0%)

sol = input().split(',')
ans = input()
a=str(sol[0])
b=int(sol[1])
c=int(sol[2])
correct=0
point=0
d=len(a)
e=len(ans)
for i in range(len(a)):
        if ans[i] == a[i]:
            point += b
            correct +=1
            d -= len(a)
            e -= len(ans)
        else:
            point -=c
            correct -=1
            d -= 0
            e -= 0

print(correct,d,e,point)

# 0998, 2022-02-17 08:16:03, compilation error (0%)

a = input().split(",")
b = list(input())
A = list(a[0])
B = int(a[1])
C = int(a[2])
score = 0
n = 0
v =9
Not Done = len(A) - len(b)
k = 0
while k<= len(b)-1 :
  if b[k] == A[k] :
    score = score + B
    n = n+1
  else :
    score = score - C
    v = v+1
  k = k+1
print(n,v,Not Done,score)
# 0999, 2022-02-17 08:16:39, --- (0%)

a = input().split(",")
b = list(input())
A = list(a[0])
B = int(a[1])
C = int(a[2])
score = 0
n = 0
v =9
Done = len(A) - len(b)
k = 0
while k<= len(b)-1 :
  if b[k] == A[k] :
    score = score + B
    n = n+1
  else :
    score = score - C
    v = v+1
  k = k+1
print(n,v,Done,score)
# 1000, 2022-02-17 08:17:09, --- (0%)

a = input().split(",")
b = input()
A = list(a[0])
B = int(a[1])
C = int(a[2])
score = 0
n = 0
v =9
Done = len(A) - len(b)
k = 0
while k<= len(b)-1 :
  if b[k] == A[k] :
    score = score + B
    n = n+1
  else :
    score = score - C
    v = v+1
  k = k+1
print(n,v,Done,score)

# 1001, 2022-02-17 08:14:56, xxx (0%)

teacher = input().split(',')
student = str(input())
count = 0
false = 0
true = 0
def least_pn_having(student):
    count = 0
    while count < len(teacher):
      check = 0
      ans = teacher[0]
      for e in ans:
        if student[check] == e:
          check = check + 1
          true += 1
        else:
          false += 1
      count = count + 1
      return check
print(least_pn_having(student,false))
# 1002, 2022-02-17 08:15:01, xxx (0%)

teacher = input().split(',')
student = str(input())
count = 0
false = 0
true = 0
def least_pn_having(student):
    count = 0
    while count < len(teacher):
      check = 0
      ans = teacher[0]
      for e in ans:
        if student[check] == e:
          check = check + 1
          true += 1
        else:
          false += 1
      count = count + 1
      return check
print(least_pn_having(student,true,false))
# 1003, 2022-02-17 08:15:37, xxx (0%)

teacher = input().split(',')
student = str(input())
count = 0
false = 0
true = 0
def least_pn_having(student):
    count = 0
    while count < len(teacher):
      check = 0
      ans = teacher[0]
      for e in ans:
        if student[check] == e:
          check = check + 1
          true += 1
        else:
          false += 1
      count = count + 1
      return check
print(least_pn_having(student),true,false)

# 1004, 2022-02-17 08:14:13, xxx (0%)

correct_ans,correct_score, wrong_score = input().split(",")
correct_score = int(correct_score)
wrong_score = int(wrong_score)

ans = input()
sum = 0
correct = 0
wrong = 0
undo = 0
for i in range(len(correct_ans)):
    if ans[i] == "-" or i > len(ans):
        undo += 1
    elif ans[i] == "T" and correct_ans == "T":
        correct += 1
        sum += correct_score
    else:
        wrong += 1
        sum -= wrong_score
        if sum < 0:
            sum = 0
print(correct+" "+wrong+" "+undo+" "+sum)

# 1005, 2022-02-17 08:15:13, xxx (0%)

correct_ans,correct_score, wrong_score = input().split(",")
correct_score = int(correct_score)
wrong_score = int(wrong_score)

ans = input()
sum = 0
correct = 0
wrong = 0
undo = 0
for i in range(len(correct_ans)):
    if ans[i] == "-" or i > len(ans):
        undo += 1
    elif ans[i] == "T" and correct_ans[i] == "T":
        correct += 1
        sum += correct_score
    else:
        wrong += 1
        sum -= wrong_score
        if sum < 0:
            sum = 0
print(correct+" "+wrong+" "+undo+" "+sum)

# 1006, 2022-02-17 08:16:49, --x (0%)

correct_ans,correct_score, wrong_score = input().split(",")
correct_score = int(correct_score)
wrong_score = int(wrong_score)

ans = input()
sum = 0
correct = 0
wrong = 0
undo = 0
for i in range(len(correct_ans)):
    if ans[i] == "-" or i > len(ans):
        undo += 1
    elif ans[i] == "T" and correct_ans[i] == "T":
        correct += 1
        sum += correct_score
    else:
        wrong += 1
        sum -= wrong_score
        if sum < 0:
            sum = 0
print(str(correct)+" "+str(wrong)+" "+str(undo)+" "+str(sum))


# 1007, 2022-02-17 08:14:09, compilation error (0%)

a = input().split(",")
b = list(input())
A = list(a[0])
n_t = 0
n_f = 0
if len(A) != len(b):
    
for i in range(len(A)):
    if A[i] == b[i]:
        n_t += int(a[1])
    if A[i] != b[i]:
        n_f -= int(a[2])

# 1008, 2022-02-17 08:14:32, --x (0%)

a = input().split(",")
b = list(input())
A = list(a[0])
n_t = 0
n_f = 0

for i in range(len(A)):
    if A[i] == b[i]:
        n_t += int(a[1])
    if A[i] != b[i]:
        n_f -= int(a[2])
# 1009, 2022-02-17 08:15:06, --x (0%)

a = input().split(",")
b = list(input())
A = list(a[0])
n_t = 0
n_f = 0

for i in range(len(A)):
    if A[i] == b[i]:
        n_t += int(a[1])
    if A[i] != b[i]:
        n_f -= int(a[2])
print(n_t, n_f)

# 1010, 2022-02-17 08:14:11, xxx (0%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = tint(cr) - fint(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)
# 1011, 2022-02-17 08:14:51, xxx (0%)

qc,cr,wr = input().split(',')
ans = input()

sc = 0
t = 0
f = 0
non = len(qc)-len(ans)
for i in range (len(ans)):
    if ans[i] == '-' :
        non += 1
    elif ans[i] == qc[i] :
        t += 1
    elif ans[i] != qc[i] :
        f += 1

sc = tint(cr) - fint(wr)
if sc>0 :
    print(t,f,non,sc)
else :
    print(t,f,non,0)
# 1012, 2022-02-17 08:15:09, xxx (0%)

a = input().split(',')
b = input()
n = 0
k = 0
m = 0
for i in b:
    if i == a[n]:
        k +=1
    elif i == '-':
        l +=1
    else:
        m += 1
x = (k*int(a[1])-m*int(a[2]))
if x<0:
    x =0
print(str(k)+' '+str(m)+' '+str(l)+' '+str(x))

# 1013, 2022-02-17 08:14:34, xxx (0%)

real_ans = input().split(',')
st_ans = input()
used_st_ans = list(st_ans)

true_ans = real_ans[0]
l = len(real_ans[0])
n = 0
true_count = 0
false_count = 0
diddone_count = 0
point = 0
while n != l-1 :
    if true_ans[n] in st_ans[n] :
        point += int(real_ans[1])
        true_count += 1
    elif real_ans[n] in '-' :
        point += 0
        diddone_count += 1
    else :
        point -= int(real_ans[2])
        false_count += 1
        
    n += 1
    
print(true_count, false_count, diddone_count, point)

# 1014, 2022-02-17 08:17:03, xxx (0%)

real_ans = input().split(',')
st_ans = input()
used_st_ans = list(st_ans)

true_ans = real_ans[0]
l = len(real_ans[0])
n = 0
true_count = 0
false_count = 0
diddone_count = 0
point = 0
while n != l :
    if true_ans[n] in st_ans[n] :
        point += int(real_ans[1])
        true_count += 1
    elif real_ans[n] in '-' :
        point += 0
        diddone_count += 1
    else :
        point -= int(real_ans[2])
        false_count += 1
        
    n += 1
    
print(true_count, false_count, diddone_count, point)

# 1015, 2022-02-17 08:17:23, xxx (0%)

real_ans = input().split(',')
st_ans = input()
used_st_ans = list(st_ans)

true_ans = real_ans[0]
l = len(real_ans[0])
n = 0
true_count = 0
false_count = 0
diddone_count = 0
point = 0
while n != l :
    if true_ans[n] in st_ans[n] :
        point += int(real_ans[1])
        true_count += 1
    elif real_ans[n] in '-' :
        point += 0
        diddone_count += 1
    else :
        point -= int(real_ans[2])
        false_count += 1
        
    n += 1
    
print(true_count, false_count, diddone_count, point)


# 1016, 2022-02-17 08:15:37, xxx (0%)

AC = input().split(",")
AC1 =AC[0]
A = input()
c=0
w=0
n=0
for i in range(len(AC1)) :

    if AC1[i] == A[i] :
        if AC1[i] == "T" :
            C +=1
            if AC1[i] == "F" :
                W +=1
    elif A[i] == "-" :
        n +=1

s1 = (c*int(AC[1]))-(w*int(AC[2]))
    
print(s1)
    


# 1017, 2022-02-17 08:16:07, --x (0%)

AC = input().split(",")
AC1 =AC[0]
A = input()
c=0
w=0
n=0
for i in range(len(AC1)) :

    if AC1[i] == A[i] :
        if AC1[i] == "T" :
            c +=1
            if AC1[i] == "F" :
                W +=1
    elif A[i] == "-" :
        n +=1

s1 = (c*int(AC[1]))-(w*int(AC[2]))
    
print(s1)
# 1018, 2022-02-17 08:16:58, --x (0%)

AC = input().split(",")
AC1 =AC[0]
A = input()
c=0
w=0
n=0
for i in range(len(AC1)) :

    if AC1[i] == A[i] :
        if AC1[i] == "T" :
            c +=1
            if AC1[i] == "F" :
                W +=1
    elif A[i] == "-" :
        n +=1

s1 = (c*int(AC[1]))-(w*int(AC[2]))
    
print(c,w,n,s1)

# 1019, 2022-02-17 08:13:05, --- (0%)

x = input().split(",")
ans = x[0]
c = 0
y = input()
n = 0
for i in range(5) :
    if y[i] == x[0][i] :
        c += 1
    elif y[i] == "-" :
        n += 1
a = 5-c-n
h = (c*int(x[1])) - (a*int(x[2]))
if h < 0 :
    h == 0
print(c,n,a,h)
# 1020, 2022-02-17 08:13:52, --- (0%)

x = input().split(",")
ans = x[0]
c = 0
y = input()
n = 0
for i in range(5) :
    if y[i] == x[0][i] :
        c += 1
    elif y[i] == "-" :
        n += 1
a = 5-c-n
h = (c*int(x[1])) - (a*int(x[2]))
if h < 0 :
    h == 0
print(c,a,n,h)
# 1021, 2022-02-17 08:15:36, --- (0%)

x = input().split(",")
ans = x[0]
c = 0
y = input()
n = 0
for i in range(5) :
    if i > (len(x)) :
        n += 1
    elif y[i] == x[0][i] :
        c += 1
    elif y[i] == "-" :
        n += 1
a = 5-c-n
h = (c*int(x[1])) - (a*int(x[2]))
if h < 0 :
    h == 0
print(c,a,n,h)
        

# 1022, 2022-02-17 08:12:46, --x (0%)

a,x,y = input().split(',')
b = input()
aa = len(a)
aaa = int(aa)
t = 0
f = 0
i = 0
for i in range(0, aaa):
  if (a[i]==b[i]):
    t = t+1
  elif (a[i]!=b[i]):
    if (a[i]=='-'):
      f=f+0
    else:
      f = f+1
if len(a)==len(b):
  for i in range(0, aaa):
    if (a[i]=='-'):
      n = 0
    else:
      n = 0
elif len(a)>len(b):
  n = len(a)-len(b)
marks = int(t)*3-int(f)

print(t, end=' ')
print(f ,end=' ')
print(n, end=' ')
print(marks ,end='')
# 1023, 2022-02-17 08:14:06, --- (0%)

a,x,y = input().split(',')
b = input()
aa = len(a)
aaa = int(aa)
t = 0
f = 0
i = 0
for i in range(0, len(b)):
  if (a[i]==b[i]):
    t = t+1
  elif (a[i]!=b[i]):
    if (a[i]=='-'):
      f=f+0
    else:
      f = f+1
if len(a)==len(b):
  for i in range(0, aaa):
    if (a[i]=='-'):
      n = 0
    else:
      n = 0
elif len(a)>len(b):
  n = len(a)-len(b)
marks = int(t)*3-int(f)

print(t, end=' ')
print(f ,end=' ')
print(n, end=' ')
print(marks ,end='')

# 1024, 2022-02-17 08:15:21, --- (0%)

a,x,y = input().split(',')
b = input()
aa = len(a)
aaa = int(aa)
t = 0
f = 0
i = 0
for i in range(0, len(b)):
  if (a[i]==b[i]):
    t = t+1
  elif (a[i]!=b[i]):
    if (a[i]=='-'):
      f=f+0
    else:
      f = f+1
if len(a)==len(b):
  for i in range(0, aaa):
    if (a[i]=='-'):
      n = 0
    else:
      n = 0
elif len(a)>len(b):
  n = len(a)-len(b)
if len(a)<=5:
  marks = int(t)*3-int(f)
else:
  marks = int(t)*2-int(f)

print(t, end=' ')
print(f ,end=' ')
print(n, end=' ')
print(marks ,end='')

# 1025, 2022-02-17 08:14:09, --- (0%)

fin = input()
soln = input()
if len(fin) != len(soln) :
    print('Incomplete answer')
else :
    a = 0
    for i in range(len(fin)) :
        if soln[i] == fin[i]:
            a += 1
    print(a)
# 1026, 2022-02-17 08:14:28, compilation error (0%)

fin = input()
soln = input()
a = 0
    for i in range(len(fin)) :
        if soln[i] == fin[i]:
            a += 1
    print(a)
# 1027, 2022-02-17 08:14:48, xxx (0%)

sol = str(input().split(','))
ans = str(input())
a = 0
for i in range(len(sol)) :
    if ans[i] == sol[i]:
        a += 1
print(a)
   

# 1028, 2022-02-17 08:15:17, --x (0%)

a1,a2,a3=input().split(',')

d=input()
a3,w,n=0,0,0


for i in range(len(a1)):
    if d[i] == '-':
        n+=1
    elif a1[i] == d[i]:
        a3+=1
    else:
        w+=1
print(a3,w,n,(int(a2)*a3)-(int(a3)*w))
# 1029, 2022-02-17 08:16:08, --x (0%)

a1,a2,a3=input().split(',')
d=input()
a3,w,n=0,0,0
for i in range(len(a1)):
    if d[i] == '-':
        n+=1
    elif a1[i] == d[i]:
        a3+=1
    else:
        w+=1
print(a3,w,n,(int(a2)*a3)-(int(a3)*w))
# 1030, 2022-02-17 08:16:36, --x (0%)

a1,a2,a3=input().split(',')
d=input()
a3,w,n=0,0,0
for i in range(len(a1)):
    if d[i] == '-':
        n+=1
    elif a1[i] == d[i]:
        a3+=1
    else:
        w+=1
print(a3,w,n,(int(a2)*a3)-(int(a3)*w))

# 1031, 2022-02-17 08:15:42, compilation error (0%)

x,point,f = str(i) for i in range len(input()).split(',')
point = int(point)
f = int(f)
t = 0
tt = 0
n = 0
ff = 0
check = 0
print(x,point,f)
for i in range(len(x)) :
    a = input()
    if x[i] == a[i] :
        t += point
        tt += 1
    else :
        t = t-f
        ff += 1
        
    if a[i] == '-' :  n += 1
    
print(tt,ff,n,t)
# 1032, 2022-02-17 08:16:09, xxx (0%)

x,point,f = input()
point = int(point)
f = int(f)
t = 0
tt = 0
n = 0
ff = 0
check = 0
print(x,point,f)
for i in range(len(x)) :
    a = input()
    if x[i] == a[i] :
        t += point
        tt += 1
    else :
        t = t-f
        ff += 1
        
    if a[i] == '-' :  n += 1
    
print(tt,ff,n,t)

# 1033, 2022-02-17 08:16:29, TTT (0%)

x=input().split(',')
y=input()
i=0
s=0
while i<len(y):
  if x[0][i]==y[0]:
    s+=1
    i+=1
z=len(x[0])-s
score1=3*(s)
score2=(-1)*z
t=score1+score2
print(str(s),str(z),str(len(y)-len(x[0])),str(t))
# 1034, 2022-02-17 08:17:02, TTT (0%)

x=input().split(',')
y=input()
i=0
s=0
while i<len(y):
  if x[0][i]==y[0]:
    s+=1
    i+=1
z=len(x[0])-s
score1=3*(s)
score2=(-1)*z
t=score1+score2
print(str(s),str(z),str(len(y)-len(x[0])),str(t))

# 1035, 2022-02-17 08:14:26, --- (0%)

x = input().split(',')
ans = x[0]
w = input()
cor = 0
n = 0
x[1]=int(x[1])
x[2]=int(x[2])
for e in range(5):
        if w[e]==x[0][e]:
                cor=cor+1
        elif w[e]=='-':
                n = n+1
inc = 5-cor-n
score = (cor*x[1]-inc*x[2])
if score < 0:
        score = 0
else:
     pass
print(cor, inc, n, score)
# 1036, 2022-02-17 08:15:43, --- (0%)

x = input().split(',')
ans = x[0]
w = input()
cor = 0
n = 0
x[1]=int(x[1])
x[2]=int(x[2])
for e in range(5):
        if e>len(x):
                n=n+1
        if w[e]==x[0][e]:
                cor=cor+1
        elif w[e]=='-':
                n = n+1
        
inc = 5-cor-n
score = (cor*x[1]-inc*x[2])
if score < 0:
        score = 0
else:
     pass
print(cor, inc, n, score)

# 1037, 2022-02-17 08:14:54, compilation error (0%)

K = bool(input())
A = bool(input()); B = bool(input()); C = bool(input()) \
  = bool(input()); E = bool(input())
S = 0
if len(A) == len(K):
    for i in range (len(A)):
        if A[i] == A[i]: S += 1 ; T += 1
        else : S -= 1 ; F +=1
    print(T, F, N, S)
else:
  for i in range (len(A)):
        if A[i] == - : S += 0 ; N +=1
    print(T, F, N, S)
# 1038, 2022-02-17 08:16:17, compilation error (0%)

K = bool(input())
A = bool(input()); B = bool(input()); C = bool(input()) \
  = bool(input()); E = bool(input())
S = 0
if len(A) == len(K):
    for i in range (len(A)):
        if A[i] == K[i]: S += 1 ; T += 1
        else : S -= 1 ; F +=1
    print(T, F, N, S)
else:
  for i in range (len(A)):
        if A[i] == K[i] : S += 0 ; N +=1
    print(T, F, N, S)

# 1039, 2022-02-17 08:16:21, -xx (0%)

a,b,c=input().split(',')
d=input()
x,y,z=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        n+=1
    elif a[i] == d[i]:
        x+=1
    else:
        y+=1
print(x,y,z,(int(b)*x)-(int(x)*y))
# 1040, 2022-02-17 08:16:48, --x (0%)

a,b,c=input().split(',')
d=input()
x,y,z=0,0,0
for i in range(len(a)):
    if d[i] == '-':
        z+=1
    elif a[i] == d[i]:
        x+=1
    else:
        y+=1
print(x,y,z,(int(b)*x)-(int(x)*y))

# 1041, 2022-02-17 08:13:56, --x (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
  if d[i]=='-':
    n+=1
  elif a[i]==d[i]:
    c+=1
  else:
    w+=1
print(c,w,n,(int(b)*c)-(int(c)*w))
# 1042, 2022-02-17 08:15:34, compilation error (0%)

a,b,c=input().split(',')
d=input()
c,w,n=0,0,0
for i in range(len(a)):
  if d[i]=='-':
    n+=1
  elif a[i]==d[i]:
    c+=1
  else:
    w+=1
print((c,w,n,(int(b)*c)-(int(c)*w))

# 1043, 2022-02-17 08:15:31, --- (0%)

ans=input()
listans=list(ans)
mine=input()
n=0
correct=0
incorrect=0
blank=0
while n<len(ans[0]):
    if mine[n]==listans[n]:
        correct+=1
    else:
        if mine[n]=='-' or mine[n]==' ':
            blank+=1
        else:
            incorrect+=1
    n+=1

print(str(correct)+str(incorrect)+str(blank))

# 1044, 2022-02-17 08:17:14, --- (0%)

ans=input()
listans=list(ans)
mine=input()
n=0
correct=0
incorrect=0
blank=0
while n<len(ans[0]):
    if mine[n]==listans[n]:
        correct+=1
    else:
        if mine[n]=='-' or mine[n]==' ':
            blank+=1
        else:
            incorrect+=1
    n+=1

print(str(correct)+str(incorrect)+str(blank)+str(correct*listans[-3]+incorrect*listans[-1]))


# 1045, 2022-02-17 08:08:38, xxx (0%)

sol,pt,pf = input().split(',')
ans =input()

ct = 0
p = 0
cf = 0
for i in range(len(sol)):
    if sol[i] == 'T':
        ct += 1
        p1 = ct * pt

    elif sol[i] == 'F':
        cf += 1
        p2 = cf * (-pf)

print(ct,cf,(len(sol)-(ct+cf),p1+p2))
# 1046, 2022-02-17 08:17:20, --x (0%)

sol,pt,pf = input().split(',')
ans =input()

ct = 0
p = 0
cf = 0
p1 = 0
p2 = 0
for i in range(len(sol)):
    if ans[i] == sol[i]:
        ct += 1
        p1 += ct
        

    elif ans[i] == sol[i]:
        cf += 1
        p2 -= cf
        



print(ct,cf,(len(sol)-(ct+cf)),p1+p2-5)

# 1047, 2022-02-17 08:16:02, --- (0%)

ans1,correct,wrong = input().split(",")
ans2 = input()
i = 1
p1=0
w1=0
n1=0
if int(len(ans1))>=int(len(ans2)):
    while i<len(ans2):
        if ans1[i]==ans2[i]:
            p1+=1
        if ans1[i]!=ans2[i] and ans2[i]!= "-":
            w1+=1
        if ans2[i]=="-":
            n1+=1
        i+=1
else:
    ans2 = ans2[0:int(len(ans1))+1:]
score = int(p1)*int(correct)-int(w1)*int(wrong)
print(str(p1)+" "+str(w1)+" "+str(n1)+" "+str(score))
# 1048, 2022-02-17 08:16:45, --- (0%)

ans1,correct,wrong = input().split(",")
ans2 = input()
i = 1
p1=0
w1=0
n1=0
if int(len(ans1))>=int(len(ans2)):
    while i<len(ans2):
        if ans1[i]==ans2[i]:
            p1+=1
        if ans1[i]!=ans2[i] and ans2[i]!= "-":
            w1+=1
        if ans2[i]=="-":
            n1+=1
        i+=1
else:
    ans2 = ans2[0:int(len(ans1))+1:]
    while i<len(ans2):
        if ans1[i]==ans2[i]:
            p1+=1
        if ans1[i]!=ans2[i] and ans2[i]!= "-":
            w1+=1
        if ans2[i]=="-":
            n1+=1
        i+=1
score = int(p1)*int(correct)-int(w1)*int(wrong)
print(str(p1)+" "+str(w1)+" "+str(n1)+" "+str(score))

# 1049, 2022-02-17 08:13:43, xxx (0%)

data = input().split(",")
student_answer = input()
ts = 0
fs = 0
us = 0
total = 0
for i in range(len(student_answer)):
  if student_answer[i] == data[0][i]:
    ts += 1
    total += int(data[1])
  elif student_answer[i] == "-":
    us += 1
  else:
    fs += 1
    total -= int(data[2])
us += len(data[0])-len(student_answer)
p = max(0,p)

print(ts,fs,us,total)
# 1050, 2022-02-17 08:15:31, xxx (0%)

data = input().split(",")
student_answer = input()
ts = 0
fs = 0
us = 0
total = 0
for i in range(len(student_answer)):
  if student_answer[i] == data[i]:
    ts += 1
    total += int(data[1])
  elif student_answer[i] == "-":
    us += 1
  else:
    fs += 1
    total -= int(data[2])
us += len(data[0])-len(student_answer)
p = max(0,p)

print(ts,fs,us,total)

# 1051, 2022-02-17 08:13:15, xxx (0%)

s= input()
t = input()
n = 0
p = 0
at = 0
af = 0
j = len(s)
t = int(s[-3])
f = int(s[-1])
if len(s)!=len(t):
    j=len(s)-len(t)
for i in range(len(t)-4):
    if t[i]=='-':
        n+=0
        p+=1
    elif s[i]==t[i]:
        n+=t
        at+=1
    elif s[i]!=t[i]:
        n-=f
        af+=1
print(at,af,p+j,n)
# 1052, 2022-02-17 08:16:03, --- (0%)

s= input()
t = input()
n = 0
p = 0
at = 0
af = 0
j = len(s)
t = int(s[-3])
f = int(s[-1])

for i in range(t-4):
    if t[i]=='-':
        n+=0
        p+=1
    elif s[i]==t[i]:
        n+=t
        at+=1
    elif s[i]!=t[i]:
        n-=f
        af+=1
print(at,af,p+j,n)
    

# 1053, 2022-02-17 08:14:13, xxx (0%)

x=input().split(",")
y=input()
X=x[0].split()
s=0
for i in range(x[0]):
    if y[i]==X[i]:
        s+=1
print(X[1])
# 1054, 2022-02-17 08:14:23, xxx (0%)

x=input().split(",")
y=input()
X=x[0].split()
s=0
for i in range(x[0]):
    if y[i]==X[i]:
        s+=1
print(s)

# 1055, 2022-02-17 08:14:55, xxx (0%)

sol = input()
ans = input()
if len(sol) != len(ans) :
  dif = int(len(sol)) - 4 - int(len(ans))
else :
  point = 0
  for i in range(len(sol)) :
    if ans[i] == sol[i] :
      point += 1
print(point + ',' + str(dif))
# 1056, 2022-02-17 08:15:19, compilation error (0%)

sol = input()
ans = input()
point = 0
  for i in range(len(sol)) :
    if ans[i] == sol[i] :
      point += 1
print(point)

# 1057, 2022-02-17 08:14:29, compilation error (0%)

a = input()
b = input()
c = a.split(,)
d = len(c[0])
k = 0
for i in range (o,d):
    if c[i] == b[i]:
        k += 1

print(k,d-k,'0',(k*c[1])-((d-k)*c[2])
# 1058, 2022-02-17 08:15:12, compilation error (0%)

a = input()
b = input()
c = a.split(',')
d = len(c[0])
k = 0
for i in range (o,d):
    if c[i] == b[i]:
        k += 1

print(k,d-k,'0',(k*c[1])-((d-k)*c[2])

# 1059, 2022-02-17 08:14:57, compilation error (0%)

s=input().split(,)
a=input()
e1=0
e2=0
e3=0
for i in s :
  if 'A'<= i <= 'Z':
    if a[i] == s[i] :
      e1+=1
    else:
      e2+=1
  else:
    e3+=1
total = (e1*s[1])-(e2*s[2])
print(e1,e2,e3,total)
# 1060, 2022-02-17 08:16:30, xxx (0%)

s=input().split(',')
a=input()
e1=0
e2=0
e3=0
for i in s :
  if 'A'<= i <= 'Z':
    if a[i] == s[i] :
      e1+=1
    else:
      e2+=1
  else:
    e3+=1
total = (e1*s[1])-(e2*s[2])
print(e1,e2,e3,total)

# 1061, 2022-02-17 08:14:22, --- (0%)

x = input()
y = input()
tx = ""
ty = ""
for ch in x :
  if ch == "T" or ch <= "F" or "0" <= ch <= "9" :
    tx += ch

for ch in y :
  if ch == "T" or ch <= "F" or ch == "-":
    tx += ch

g = 0
l = 0
k = 0
for i in range(len(ty)) :
  if tx[i] == ty[i] :
    g += 1
  elif ty[i] == "-" :
    k += 1
  else :
    l += 1
p = g*tx[-2]+l*tx[-1]
print(g, l , k, p)
# 1062, 2022-02-17 08:16:52, --- (0%)

x = input()
y = input()
tx = ""
ty = ""
for ch in x :
  if ch == "T" or ch <= "F" or "0" <= ch <= "9" :
    tx += ch

for ch in y :
  if ch == "T" or ch <= "F" or ch == "-":
    ty += ch

g = 0
l = 0
k = 0
for i in range(len(ty)) :
  if tx[i] == ty[i] :
    g += 1
  elif ty[i] == "-" :
    k += 1
  else :
    l += 1
p = g*tx[-2]+l*tx[-1]
print(g, l , k, p)

# 1063, 2022-02-17 08:15:17, -TT (0%)

abc=input().split(',')
a=str(abc[0])
b=float(abc[1])
c=float(abc[2])
d=str(input())
t=0
i=0
while a[i]==d[i]:
    t+=1
    i+=1
j=0
o=0
while d[i]=='-':
    o+=1
    j+=1
f=len(d)-t-o
s=t*int(b)+f*int(c)*-1
print(t,f,o,s)
# 1064, 2022-02-17 08:17:03, -TT (0%)

abc=input().split(',')
a=str(abc[0])
b=float(abc[1])
c=float(abc[2])
d=str(input())
t=0
i=0
while a[i]==d[i]:
    t+=1
    i+=1
o=0
j=0
while d[i]=='-':
    o+=1
    j+=1
f=len(d)-t-o
s=t*int(b)+f*int(c)*-1
print(t,f,o,s)

# 1065, 2022-02-17 08:14:03, xx- (0%)

a,b,c = input().split(',')
m = input()
x = 0
y = 0
z = 0
w = 0
if len(a) != len(m) :
  z += 1
elif m[i] == '-' :
  w += 1
else :
  for i in range(0,len(a)):
    if a[i] == m[i] :
      x += 1
    elif a[i] != m[i] :
      y += 1
print(x,y,(int(y)-int(w)),((int(x)*int(b))-(int(y)*int(c))))
# 1066, 2022-02-17 08:16:37, xx- (0%)

a,b,c = input().split(',')
m = input()
x = 0
y = 0
z = 0
w = 0
if len(a) != len(m) :
  z += 1
elif m[i] == '-' :
  w += 1
else :
  for i in range(0,len(a)):
    if a[i] == m[i] :
      x += 1
    elif a[i] != m[i] :
      y += 1
print(x,int(y)-int(w),int(w)+int(z),((int(x)*int(b))-(int(y)*int(c))))

# 1067, 2022-02-17 08:14:42, --- (0%)

t = input().split(',')
s = input()
c = t[0]
true = 0
false = 0
k = 0
for e in range(len(s)):
    if c[e] == s[e]:
        true += 1
    if s[e] == '-' :
        k += 1
    else :
        false += 1
print(int(true)*int(t[1]),int(false)*int(t[2]),len(c)-len(s)+k,int(true)*int(t[1])-int(false)*int(t[2]))
# 1068, 2022-02-17 08:15:21, --- (0%)

t = input().split(',')
s = input()
c = t[0]
true = 0
false = 0
k = 0
for e in range(len(s)):
    if c[e] == s[e]:
        true += 1
    if s[e] == '-' :
        k += 1
    else :
        false += 1
print(int(true)*int(t[1]),int(false)*int(t[2]),len(c)-len(s)+k,int(true)*int(t[1])-int(false)*int(t[2]))

# 1069, 2022-02-17 08:13:12, xxx (0%)

answer = input().split(",")
guess = input()
true = 0
false = 0
not_done = 0
score = 0

for i in range(len(guess)):
  if guess[i] == answer[0][i]:
    true += 1
    score += int(ans[1])
    
  elif guess[i] == "-":
    not_done += 1
    
  else:
    false += 1
    score -= int(l1[2])
    
not_done += len(l1[0])-len(s1)

if score <= 0:
    score = 0

print(true,false,not_done,score)
# 1070, 2022-02-17 08:14:31, xxx (0%)

answer = a.split()
print(answer)
guess = input().split()
score = 0
count_yes = 0
count_wrong = 0
not_done = int(len(answer[0]) - len(guess))
for i in range (len(guess)) :
    if guess[i] == answer[0][i] :
        score += int(answer[1])
        count_yes += 1
    elif guess[i] == '-' :
        not_done += 1
    
    else :
        score -= int(answer[2])
        count_wrong += 1

if score <= 0 :
    score = 0

print(count_yes,count_wrong,not_done,score)

# 1071, 2022-02-17 08:12:34, --x (0%)

x,y,z=input().split(',')
d=input()
z=0
a=0
n=0
for i in range(len(x)):
    if d[i] == '-':
        n+=1
    elif x[i] == d[i]:
        z+=1
    else:
        a+=1
print(z,a,n,(int(y)*z)-(int(z)*a))
# 1072, 2022-02-17 08:14:05, --x (0%)

x,y,z=input().split(',')
d=input()
z,a,n=0,0,0
for i in range(len(x)):
    if d[i] == '-':
        n+=1
    elif x[i] == d[i]:
        z+=1
    else:
        a+=1
print(z,a,n,(int(y)*z)-(int(z)*a))


# 1073, 2022-02-17 08:16:21, compilation error (0%)

a,b,c = [str(e) for e in input().split(,)]
ans = input()
s = 0
q = 0
z = 0
p = 0
if len(ans) <= len(a):
  for i in range (len(ans)):
    if ans[i] == a[i]:
      s += 1
      q += int(b)
    elif ans[i] == '-':
      p +=1
    else:
      s -= int(c)
      z += 1
  else:
    p += 1
  if s < 0:
    s = 0
print(q,z,p,s)
# 1074, 2022-02-17 08:16:57, --- (0%)

a,b,c = [str(e) for e in input().split(",")]
ans = input()
s = 0
q = 0
z = 0
p = 0
if len(ans) <= len(a):
  for i in range (len(ans)):
    if ans[i] == a[i]:
      s += 1
      q += int(b)
    elif ans[i] == '-':
      p +=1
    else:
      s -= int(c)
      z += 1
  else:
    p += 1
  if s < 0:
    s = 0
print(q,z,p,s)

# 1075, 2022-02-17 08:12:41, --x (0%)

a = input().split(",")
key = input()
ans = a[0]
b = int(a[1])
c = int(a[2])
score = 0
if len(ans) == len(key):
    for i in range (len(ans)):
        if ans[i] == key[i]:
            score += b
        else:
            score -= c
    print(score)
else:
    for i in range (len(ans)):
        if ans[i] == key[i]:
            score += b
        elif ans[i] == " ":
            score -= c
        elif ans[i] == "-":
            score -= bc
    print(score)
# 1076, 2022-02-17 08:16:09, --x (0%)

a = input().split(",")
key = input()
ans = a[0]
b = int(a[1])
c = int(a[2])
x = 0
score = 0
if len(ans) == len(key):
    for i in range (len(ans)):
        if ans[i] == key[i]:
            score += b
            x += 1
        else:
            score -= c
            x += 0
    print(x,score)
else:
    for i in range (len(ans)):
        if ans[i] == key[i]:
            score += b
            x += 1
        elif ans[i] == " ":
            score -= c
            x += 0
        elif ans[i] == "-":
            score -= c
            x+= 0
    print(x,score)

# 1077, 2022-02-17 08:15:56, --- (0%)

correct = input().split(',')
answer = input()
p = 0
t = 0
f = 0
no = 0
for i in range(len(correct)):
    if correct[i]==answer[i]:
        p += int(correct[1])
        t += 1
    elif correct[i]==' ':
        no += 1
    elif correct[i]!=answer[i]:
        p -= int(correct[2])
        f += 1
print(p,t,f,no)


# 1078, 2022-02-17 08:16:47, --- (0%)

y=input() #TTTTT,2,1
y=y.split(',')
y1=y[0]
y2=int(y[1])
y3=int(y[2])
aws=input()
i=0
k=0
o=0
r=0
for e in y1:
    if e==y1[k]:
        i+=1
    if e!=y1[k]:
        r+=1
    if e=='-':
        o+=1
    k+=1


score=i*y2
minus=r*y3
print(i,r,o,score-minus)

# 1079, 2022-02-17 08:15:38, xxx (0%)

ans=input().split()
x=input()
c=0
ic=0
p=0
for i in range(len(ans)):
    if x[i]=="-":
        p+=1
    elif x[i]==ans[0][i]:
        c+=1
    elif x[i]!=ans[0][i]:
        ic+=1
X=(c*int(x[1]))+(ic*int(x[2]))
if X<0:
    X=0
print(c,ic,p,X)

# 1080, 2022-02-17 08:16:42, --- (0%)

x =input().split(",")
ans=input()
y=x[0]
i=0
sc=0
co =0
c=0
ba=0


# 1081, 2022-02-17 08:16:37, xxx (0%)

q=input().split(',')
qq=' '.join(q[0])
qq=qq.split(' ')
q1=len(q[0])
q2=int(q[1])#ถูก
q3=int(q[2])#ผิด
a=' '.join(input())
a=a.split(' ')
S=0
for i in range(int(q1)):
    if a[i]==q[i]:
        S+=q2
    else:
        S-=q3
print(S)

# 1082, 2022-02-17 08:16:11, --- (0%)

key = input().split(",")
#key = del key[-1:-2]
ans = list(input())
correct = 0
false = 0
blank = 0

for i in range(len(key)):
    if key[i] == ans[i]:
        correct += 1
    if key[i] != ans[i]:
        false += 1
    if "-" == ans[i]:
        blank += 1
        
        
        
print(correct,false,blank)

# 1083, 2022-02-17 08:15:44, --- (0%)

qc,cr,wr = input().split(',')
ans = input()
sc = 0
t = 0
f = 0
non = len(qc)-len(ans)






# 1084, 2022-02-17 08:15:35, --x (0%)

sol,a,b = input().split(',')
ans = input()
score = 0
a = int(a)
b = int(b)
T = 0
F = 0
N = 0
for i in range(len(sol)) :
    if ans[i] == sol :
        score += a
        T += 1
    elif i == '-' :
        N += 1
    else :
        score -= b
        F += 1
print(T, F, N, score)

# 1085, 2022-02-17 08:14:27, --x (0%)

qu=input().split(',')
ques=qu[0] 
ans=input()
point=0
depoint=0
nonpoint=0
for i in range(len(ans)):
    if ans[i]==ques[i]:
        point+=1
    elif ans[i]!=ques[i]:
        depoint+=1
if len(ans)!=len(ques):
    nonpoint+=len(depoint)-len(point)
depoint+=nonpoint
stans=''
stans+=str(point)+' '
stans+=str(nonpoint)+' '
stans+=str(nonpoint)+' '
sppoint=point*int(qu[1])
sdepoint=depoint*int(qu[2])
sumall=sppoint-sdepoint
if sumall<0:
    sumall=0
else:
    pass
stans+=str(sumall)
print(stans)
    

# 1086, 2022-02-17 08:15:10, --x (0%)

x,y,ss=input().split(',')
z=input()
ss,F,NO=0,0,0
for i in range(len(x)):
    if z[i] == '-':
        NO+=1
    elif x[i] == z[i]:
        ss+=1
    else:
        F+=1
print(ss,F,NO,(int(y)*ss)-(int(ss)*F))


# 1087, 2022-02-17 08:16:01, xxx (0%)

Ans = [c for c in input().split(',')]
Stu = input()

c = 0
w = 0
b = 0
t = 0

for i in range(len(Stu)):
    if Stu(i) == Ans[0](i):
        c += 1
    elif Stu(i) =='-':
      b += 1
        
        
    else :
        w += 1
t += (int(Ans[1])*c) - int(Ans[2]*w)

print(str(c)+' '+str(w)+' '+str(b)+' '+str(t))

# 1088, 2022-02-17 08:16:15, compilation error (0%)

x = input().split(,)
y = input()
a = x[1]
b = len(a)
c = [-1, 1]
for i in range(a[i]):
    if a[i] = T:
        
        else 

# 1089, 2022-02-17 08:14:48, xxx (0%)

x=input().split(",")
y=input()
a=0
b=0
for e in x[0] :
    if e==x[a] :
        b=b+(int(x[1]))
    else :
        if x[a]!=y[a] :
            b=b+int(x[2])
        if y[a]=="-" :
            b=b+0
    a=a+1

# 1090, 2022-02-17 08:15:37, xxx (0%)

k = input().split(',')
ans = k[0]
plus = k[1]
minus = k[2]
a = input()
c = 0
f = 0
n = 0
s = 0
l = len(ans)-len(a)
a= a+l*''


for i in range (0,len(ans)) :
    if a[i] == k[i] :
        c+=1
    elif a[i] != k[i] :
        f+=1
    elif a[i] == '-' :
        n+=1
s = str(c-(f*minus))
c =str(c)
f = str(f)
n = str(n)
print(c+''+f+''+n+''+s)

# 1091, 2022-02-17 08:16:14, --- (0%)

key = input().split(',')
ans = input()
p = 0
t = 0
f = 0
x = key[-1]
y = key[-2]
if len(key) != len(ans) :
    long = len(key) - len(ans)
    ans += 'o'*long
for i in range(len(key)):
    if key[i] == ans[i]:
        p += int(y)
        t += 1
    else:
        p -= int(x)
        f += 1
print(t,f,long,p)

# 1092, 2022-02-17 08:14:50, --- (0%)

sol = input().split(',')
sol1 = sol[0]
ans = input()
sc = 0
minus = 0
right = 0
wrong = 0
und = 0
for i in range(0,len(sol)):
    if ans[i] == '-' :
        und += 1
    else :
        if sol1[i] == ans[i]:
            sc += 1
            right += 1
        elif sol1[i] != ans[i]:
            minus += 1
            wrong += 1
    

sc = sc*int(sol[1])
minus = minus*int(sol[2])

print(right,wrong,und,sc - minus)

# 1093, 2022-02-17 08:15:39, --- (0%)

k = input().split(",")
answer = input()
key = k[0]

correct = 0
for i in range(len(answer)):
    if key[i] == answer[i]:
        point = 1
    else:
        point = 0
    correct = correct + point
wrong = len(key) - correct

not_done = 0
for c in range(len(answer)):
    if answer[c] == "-":
        no = 1
    else:
        no = 0
    not_done = not_done + no
    
plus = int(k[1])
minus = int(k[2])

total = 0
for e in range(len(answer)):
    if key[e] == answer[e] and key[e] == "T":
        dif = plus
    else:
        dif = - minus
    total = total + dif

if total <= 0:
    total = 0
else:
    pass

print(correct,wrong,not_done,total)

# 1094, 2022-02-17 08:17:12, xxx (0%)

a = input()
pl = input()
b = a.split(',')
k = b[0]
c = []
d = []
co = 0
wr = 0
no = 0
sc = 0
for i in range (len(k)):
    c.append(k[i])

for i in range (len(pl)):
    d.append(pl[i])
    
for i in range (len(pl)):
    if(d[i]==k[i]):
        co = co+1
        sc = sc + int(b[1])
    elif(d[i]=='-'):
        no = no+1
    else:
        wo = wo + 1
        sc = sc + int(b[2])
print(co,wr,no,sc)


# 1095, 2022-02-17 08:15:20, xxx (0%)

key=input().split()
ans=str(input())
s=0
n=0
for i in range(len(ans)):
    if ans[i]==key[0]:
        s+=1
    if ans[i]=="-":
        n+=1
print(s,len(key)-s,n,int(key[2])*s)

# 1096, 2022-02-17 08:16:47, --- (0%)

x = input().split(',')
y = list(x[0])
s_ans = input()
c = 0
w = 0
d = 0
b = 0
for i in range(len(x)) :
    if s_ans[i] == y[i] :
        b += int(x[1])
        c += 1
    elif s_ans[i] != y[i] :
        b -= int(x[2])
        w += 1
    elif s_ans[i] == '-' :
        d += 1
    elif b < 0 or b == 0 :
        break
    
t = c-w
print(c,w,d,t)

# 1097, 2022-02-17 08:14:53, xxx (0%)




x = input().split(",")

y = input()

h = x[0]
k = 0
v = 0
b = 0

for i in range(len(y)):
    if h[i] == "-":
        b += 1
    elif h[i] == y[i] :
        k += 1
    else:
        v += 1

sc = (k*x[1]) - (v*x[2])

print(k,v,b,sc)





# 1098, 2022-02-17 08:15:22, xxx (0%)

inp = input()
inpu = inp.split(',')
real = inp[0]

for i in range(len(real)) :
    ANS_list += ANS[i]

ans = ['-']*len(inp)
ANS = input()
ANS_list = []
for i in range(len(ANS)) :
    ANS_list += ANS[i]

for i in range(len(ANS)) :
    ans[i] = ANS_list[i]

# 1099, 2022-02-17 08:17:23, xxx (0%)

sol = input()
ans = input()
c = ' '
for i in range(0,len(sol)+1) :
    if sol[i] == ans[i] :
        c += 'T'
    elif ans[i] == '' :
        c += '-'
    else :
        c += 'F'

# 1100, 2022-02-17 08:15:29, xxx (0%)

sol=input().split(',')
ans=input()
x=sol[0]
point=0
plus=int(sol[1])
minus=int(sol[2])
f=0
c=0
for i in range (len(x)) :
    if ans[i] == x[i]:
        point+=plus
        c+=1
    else:
        point-=minus
        f+=1
print(c,f,p)
    
    


# 1101, 2022-02-17 08:17:13, xxx (0%)

s,tp,fp=input().split(',')
tp=int(tp)
fp=int(fp)
ans=input()
sums=0
true=0
false=0
notdo=len(s)-len(ans)
for i in range(len(ans)):
    if ans[i]=='-':
        notdo+=1
    elif s[i]==ans[i]:
        sums+= t
        true+=1
    elif s[i]!=ans[i]:
        sums-=f
        false+=1
if sums<0:
    sums=0
print(true,false,notdo,sums)

# 1102, 2022-02-17 08:14:42, --x (0%)

sol=input().split(',')
a=input()
s=sol[0]
m=int(sol[1])
r=int(sol[2])
correct=0
wrong=0
und=0
score=0
for i in range (len(s)) :
    if s[i]==a[i] :
        correct+=1
        score+=m
    elif (s[i]=='F' and a[i]=='T') or (s[i]=='T' and a[i]=='T'):
        wrong+=1
        score-=r
    elif (a[i]=='-') or (a[i]=='') :
        und+=1
print(correct, wrong, und, score)

# 1103, 2022-02-17 08:16:02, --- (0%)

a,b,c = input().split(',')
s = input()
n = 0
x = 0
y = 0
w = 0
point = 0
c = 0
for i in range(len(a)):
    c = len(a)
    if len(a) == len(s):
        n = 0
        w = 0
        if a[i] == s[i]:
            x += int(b)*1
        elif a[i] != s[i]:
            y += int(c)*1

        
point = x+y
print(c,w,n,point)
            

# 1104, 2022-02-17 08:16:14, compilation error (0%)

ans1 = input().split(',')
ans2 = input()
true = 0
p = 0
false = 1
non = 0

if len(ans1) != len(ans2):
    non += len(ans2) 
else :
for i in range(ans2) :
if ans1[i] == '-' :
    on += 1
    p += 2
for range(len(ans1)):
    if ans1[i] == ans2[i]:
        true += 1
    else : 
        false += 1
        p-= 1
print(true,false, non, p)
    





# 1105, 2022-02-17 08:14:38, --- (0%)

a = input()
b = input()
l = []
if len(a) == len(b):
  for i in range(len(a)):
    if a[i] == b[i]:
      l.append('.')
  print(len(l), (len(a)-len(l)), (len(a)-len(l)) )
else:
  print('Incomplete answer')

# 1106, 2022-02-17 08:17:15, compilation error (0%)

sol, spc, mpw = input(),split(",")
ans = input()
correct = 0
wrong = 0
none = 0
score = 0
x=0
while(x<len(sol)):
  if(len[sol]-len[ans] != 0)
    none = len[sol]-len[ans]
  while(x<len(ans)):
    if(sol[x]==ans[x]):
      correct +=1
    elif(ans[x] == "-")
      none += 1
    elif(sol[x]!=ans[x]):
      wrong += 1
  
  print(correct, wrong, none, score)

# 1107, 2022-02-17 08:12:43, --- (0%)

q_raw = str(input())
a = str(input())

q_raw = q_raw.split(",")
q = q_raw[0]
plus = int(q_raw[1])
minus = int(q_raw[2])

cp = 0
cs = 0
cm = 0

for i in range (len(a)) :
    if q[i] == a[i] :
        cp += 1
    elif a[i] == "-" or " ":
        cs += 1
    else :
        cm += 1

summary = cp*plus - cm*minus
print(cp,cm,cs,summary)


# 1108, 2022-02-17 08:14:40, compilation error (0%)

key = input().split(",")
ans = input().split(",")
a,b = int(key[1]),int(key[2])
x = key[0]
y = ans[0]
t = 0
s = 0
for i in range(key) :
    if x[i] == y[i] :
        s += a
        t += 1
    else :
        s -= b
        t = t
    if y[i] == "-"
        
              
print(t,)

# 1109, 2022-02-17 08:16:13, --- (0%)

t = input().split(",")
ans = input().split(",")
score = 0
nt=0
nf=0
nn=0
output =""
for i in range(len(t[1])):
    if ans[i] == t[i]:
        score += 3
        nt += 1
    elif ans[i] != t[i]:
        if score == 0:
            score -= 0
        else:
            score -= 1
            nf += 1
    else:
        score += 0
        nn += 1
output = str(nt)+" "+str(nf)+" "+str(nn)+" "+str(score)
print(output)

# 1110, 2022-02-17 08:16:09, xxx (0%)

ans = input().split(',')
sol = input().split(',')

count = 0
wrong = 0
dont = 0
i = 0
for i in sol[0]:
    if ans[i] == sol[i]:
        count += 1
    
    if ans[i] == '-':
        dont += 1
    else:
        wrong += 1

    i += 1

total = (count-wrong-dont)*(ans[2])

print(count, wrong, dont, total)

# 1111, 2022-02-17 08:15:29, xxx (0%)

a = input().split(',')
q = input()
b = a[0]
x = 0
while q[x] == b[x]:
    x += 1
for e in b:
    t += 1
print (x, )


# 1112, 2022-02-17 08:14:35, xxx (0%)

ans = input()
a = ans.split(',')
an = a[0]
cor = a[1]
w = a[2]
test = input()
score = 0
c_cor = 0
c_w = 0
no = 0
for i in range(len(a)):
    if an[i] == test[i]:
        score += cor
        c_cor +=1
    elif test[i] == '-':
        no += 1
    else:
        score -= w
        c_w += 1
print(c_cor,c_w,no,score)