solve :: String -> String -> String
solve "1" "2" = "3"
solve "2" "1" = "3"
solve "1" "3" = "2"
solve "3" "1" = "2"
solve "2" "3" = "1"
solve "3" "2" = "1"
solve _ _     = "otherwise"

main = do
    a <- getLine
    b <- getLine
    let ans = read $ solve a b :: Int
    print ans