main = do
      x<-getLine
      y<-getLine
      let 
            xs=map read (words x)::[Int]
            k=read y::Int
            t=maximum xs
            ans=(sum xs)-t+2^k*t
      putStrLn $ show $ ans