program a
    integer N
    character(10**4)::S
    read*,N
    read*,S
    do i=1,len_trim(S)
        S(i:i)=char(ichar("A")+mod(ichar(S(i:i))-ichar("A")+N,ichar("Z")-ichar("A")+1))
    end do
    print"(A)",trim(S)
end program a