Jeongeun, trained in the western country, slipped into the eastern country. After getting hold of the eastern country's information, Jeongeun decided to use an affine cipher to send it back west safely.
An affine cipher is computed with this formula.
E(X)=(aX+b)mod26
Map the letters A through Z to 0,1,2,…,25 in order. With a=3 and b=1, feeding the letter A into the formula gives E(0)=(3×0+1)mod26=1, so the encrypted result is B.
Given a, b, and a plaintext made only of uppercase letters, write a program that turns the plaintext into ciphertext.