program button
    implicit none
    integer :: a=0,b=0,coins=0,i=0
    read(*,*)a,b

    if(a<3 .or. 20<b)then
    else
        do i=1,2
            if(b<a)then
                coins = coins + a
                a = a-1
            else
                coins = coins + b
                b = b-1
            endif
        enddo
    endif
    write(*,*)coins

end program button