program main
      implicit none
      integer :: a, b
      read *, a
      read *, b

      if (( a == 1 ) .or. ( b == 1 )) then
        if (( a == 2 ) .or. ( b == 2 )) then
          print *, '3'
        else if (( a == 3 ) .or. ( b == 3 )) then
          print *, '2'
        end if
      end if
      if (( a == 2 ) .or. ( b == 2 )) then
        if (( a == 3 ) .or. ( b == 3 )) then
          print *, '1'
        end if
      end if

end program main
