import hashlib

def myhash(str):
    md5 = hashlib.md5()  # md5
    md5.update(str.encode(encoding='utf-8'))
    return md5.hexdigest()

def hex_to_bin(hexstr):
    bi = bin(int(hexstr, 16))[2:]
    return bi.zfill(128)

def str_to_bin(s):
    return ' '.join([bin(ord(c)).replace('0b', '') for c in s])

def bin_to_str(s):
    return ''.join([chr(i) for i in [int(b, 2) for b in s.split(' ')]])

def cmpcount(binstr1, binstr2):
    count = 0
    binstr1_list = list(binstr1)
    binstr2_list = list(binstr2)
    for i in range(0, len(binstr1_list)):
        if (binstr1_list[i] != binstr2_list[i]):
            count += 1
    return count

def avalanche(str, nbyte, mbit):
    # param str:计算哈希值的字符串
    # param nbyte:str的第几个字节(从低位到高位数)
    # parem mbit: nbyte的第几个bit位(从低位到高位数)

    str_md5_1 = myhash(str)
    list1 = list(str_to_bin(str[len(str) - nbyte]).zfill(8))
    if (list1[(len(str) + mbit + 1) % 8] == '1'):
        list1[(len(str) + mbit + 1) % 8] = 0
    else:
        list1[(len(str) + mbit + 1) % 8] = 1
    str_list = "".join('%s' % id for id in list1)
    str1 = bin_to_str(str_list)
    str = list(str)
    str[len(str) - nbyte] = str1
    str = ''.join(str)
    str_md5_2 = myhash(str)
    print(cmpcount(hex_to_bin(str_md5_1), hex_to_bin(str_md5_2)))

if __name__ == "__main__":
    str, nbyte, mbit = input().split()
    nbyte = int(nbyte)
    mbit = int(mbit)
    avalanche(str, nbyte, mbit)