program main
implicit none
integer :: i, j, k, a, b
character(10) :: s, t, u

read(*,*) s, t
read(*,*) a, b
read(*,*) u
if( s == u ) then
   a = a-1
else
   b = b-1
end if
write(*,'(i0, a1, i0)') a,'', b

end program main