import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
import Data.Maybe
import Data.Bits
import Data.Ord
import qualified Data.ByteString.Char8 as BS
import qualified Data.Set as Set
import Debug.Trace


listToTuple2 [a,b] = (a,b)
listToTuple3 [a,b,c] = (a,b,c)
listToTuple4 [a,b,c,d] = (a,b,c,d)

getWords = getLine >>= return . words

readIntBS = fst . fromJust . BS.readInt


main :: IO ()
main = do
  s <- getLine
  k <- readLn :: IO Integer

  putStrLn $ [if head s == '1' then
            if length s >= 2 then
              s !! 1
            else
              head s
          else
            head s]

  return ()