class LetterHelper:
# Từ điển chứa các chữ cái và giá trị tương ứng
letter_dic = {
'A': 10,
'B': 12,
'C': 13,
'D': 14,
'E': 15,
'F': 16,
'G': 17,
'H': 18,
'I': 19,
'J': 20,
'K': 21,
'L': 23,
'M': 24,
'N': 25,
'O': 26,
'P': 27,
'Q': 28,
'R': 29,
'S': 30,
'T': 31,
'U': 32,
'V': 34,
'W': 35,
'X': 36,
'Y': 37,
'Z': 38
}
@staticmethod
def check_digit(container_number, check_digit):
# Xóa khoảng trắng và dấu gạch ngang
list_digit = container_number.replace(" ", "").replace("-", "")
total_sum = 0
tmp = []
# Tính tổng cho 4 ký tự đầu
for i in range(4):
value = LetterHelper.letter_dic[list_digit[i]]
tmp.append(value * (2 ** i))
total_sum += value * (2 ** i)
# Tính tổng cho 6 ký tự còn lại
for i in range(4, 10):
x = int(list_digit[i]) # Chuyển ký tự số thành số nguyên
y = 2 ** i
tmp.append(x * y)
total_sum += x * y
# Kiểm tra tổng theo modulo 11
return check_digit == total_sum % 11
# Ví dụ sử dụng
container_number,check_digit_value= input().split()
is_valid = LetterHelper.check_digit(container_number, check_digit_value)
print(is_valid) # In ra True hoặc False
Y2xhc3MgTGV0dGVySGVscGVyOgogICAgIyBU4burIMSRaeG7g24gY2jhu6lhIGPDoWMgY2jhu68gY8OhaSB2w6AgZ2nDoSB0cuG7iyB0xrDGoW5nIOG7qW5nCiAgICBsZXR0ZXJfZGljID0gewogICAgICAgICdBJzogMTAsCiAgICAgICAgJ0InOiAxMiwKICAgICAgICAnQyc6IDEzLAogICAgICAgICdEJzogMTQsCiAgICAgICAgJ0UnOiAxNSwKICAgICAgICAnRic6IDE2LAogICAgICAgICdHJzogMTcsCiAgICAgICAgJ0gnOiAxOCwKICAgICAgICAnSSc6IDE5LAogICAgICAgICdKJzogMjAsCiAgICAgICAgJ0snOiAyMSwKICAgICAgICAnTCc6IDIzLAogICAgICAgICdNJzogMjQsCiAgICAgICAgJ04nOiAyNSwKICAgICAgICAnTyc6IDI2LAogICAgICAgICdQJzogMjcsCiAgICAgICAgJ1EnOiAyOCwKICAgICAgICAnUic6IDI5LAogICAgICAgICdTJzogMzAsCiAgICAgICAgJ1QnOiAzMSwKICAgICAgICAnVSc6IDMyLAogICAgICAgICdWJzogMzQsCiAgICAgICAgJ1cnOiAzNSwKICAgICAgICAnWCc6IDM2LAogICAgICAgICdZJzogMzcsCiAgICAgICAgJ1onOiAzOAogICAgfQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBjaGVja19kaWdpdChjb250YWluZXJfbnVtYmVyLCBjaGVja19kaWdpdCk6CiAgICAgICAgIyBYw7NhIGtob+G6o25nIHRy4bqvbmcgdsOgIGThuqV1IGfhuqFjaCBuZ2FuZwogICAgICAgIGxpc3RfZGlnaXQgPSBjb250YWluZXJfbnVtYmVyLnJlcGxhY2UoIiAiLCAiIikucmVwbGFjZSgiLSIsICIiKQogICAgICAgIHRvdGFsX3N1bSA9IDAKICAgICAgICB0bXAgPSBbXQoKICAgICAgICAjIFTDrW5oIHThu5VuZyBjaG8gNCBrw70gdOG7sSDEkeG6p3UKICAgICAgICBmb3IgaSBpbiByYW5nZSg0KToKICAgICAgICAgICAgdmFsdWUgPSBMZXR0ZXJIZWxwZXIubGV0dGVyX2RpY1tsaXN0X2RpZ2l0W2ldXQogICAgICAgICAgICB0bXAuYXBwZW5kKHZhbHVlICogKDIgKiogaSkpCiAgICAgICAgICAgIHRvdGFsX3N1bSArPSB2YWx1ZSAqICgyICoqIGkpCgogICAgICAgICMgVMOtbmggdOG7lW5nIGNobyA2IGvDvSB04buxIGPDsm4gbOG6oWkKICAgICAgICBmb3IgaSBpbiByYW5nZSg0LCAxMCk6CiAgICAgICAgICAgIHggPSBpbnQobGlzdF9kaWdpdFtpXSkgICMgQ2h1eeG7g24ga8O9IHThu7Egc+G7kSB0aMOgbmggc+G7kSBuZ3V5w6puCiAgICAgICAgICAgIHkgPSAyICoqIGkKICAgICAgICAgICAgdG1wLmFwcGVuZCh4ICogeSkKICAgICAgICAgICAgdG90YWxfc3VtICs9IHggKiB5CgogICAgICAgICMgS2nhu4NtIHRyYSB04buVbmcgdGhlbyBtb2R1bG8gMTEKICAgICAgICByZXR1cm4gY2hlY2tfZGlnaXQgPT0gdG90YWxfc3VtICUgMTEKCgojIFbDrSBk4bulIHPhu60gZOG7pW5nCmNvbnRhaW5lcl9udW1iZXIsY2hlY2tfZGlnaXRfdmFsdWU9IGlucHV0KCkuc3BsaXQoKQppc192YWxpZCA9IExldHRlckhlbHBlci5jaGVja19kaWdpdChjb250YWluZXJfbnVtYmVyLCBjaGVja19kaWdpdF92YWx1ZSkKcHJpbnQoaXNfdmFsaWQpICAjIEluIHJhIFRydWUgaG/hurdjIEZhbHNlCg==