program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: i
    character(3):: n

    read*, n
    do i=1,3
        if (n(i:i) == '1') then
            n(i:i) = '9'
        else if (n(i:i) == '9') then
            n(i:i) = '1'
        end if
    end do
    print'(a)', n
end program main