输入样例 1:
3862767 6 13530293 3
输出样例 1:
399
输入样例 2:
3862767 1 13530293 8
输出样例 2:
0
# -*- coding: utf-8 -*-if __name__ == '__main__':input_list = input().split()a, d_a, b, d_b = input_list[0], input_list[1], input_list[2], input_list[3]total_a, total_b = 0, 0for c in a:if c == d_a:total_a += 1for c in b:if c == d_b:total_b += 1if total_a and total_b:result = eval(d_a * total_a) + eval(d_b * total_b)else:result = 0print(result)