local s = io.read();
local k = tonumber(io.read());
local first = string.sub(s,1,1);

if k == 1 or string.len(s) == 1 then
    print(first);
elseif tonumber(first) == 1 then
    print(string.sub(s,2,2));
else
    print(string.sub(s,1,1));
end