if_ t f True = t
if_ t f False = f

main = do
  [s, t] <- words <$> getLine
  [a, b] <- map read . words <$> getLine
  u <- getLine
  putStrLn . unwords . (map show) $ if_ [a - 1, b] [a, b - 1] $ u == s
