This page is still under construction.

Parts of this page are still being built. What you see may change.

Big Bang Secrets

Interview

Time limit2sMemory limit512 MB

Summary
Decode an uppercase word by shifting each letter backward by S = 3P + K positions, where P is the letter's 1-based position.
Level

Easy2 of 10

Topics
Implementation, String, Math
Solved
No attempts yet

Problem

Sheldon and Leonard are physicists obsessed with the BIG BANG theory. To exchange secret insights, they devised a code that encrypts UPPERCASE words by shifting each letter forward.

Shifting a letter by SS positions means moving forward SS letters in the alphabet. For example, shifting B by S=3S = 3 positions gives E. Sometimes this moves past Z, the last letter of the alphabet; whenever that happens we wrap around, treating A as the letter that follows Z. For example, shifting Z by S=2S = 2 positions gives B.

The code depends on a parameter KK and also varies with the position of each letter in the word. For the letter at position PP, the shift value used is S=3P+KS = 3P + K. (The first letter is at position P=1P = 1.)

For example, here is how ZOOM is encoded when K=3K = 3. The first letter Z has shift value S=3×1+3=6S = 3 \times 1 + 3 = 6; it wraps around and becomes F. The second letter O has S=3×2+3=9S = 3 \times 2 + 3 = 9 and becomes X. The last two letters become A and B. So Sheldon sends Leonard the secret message FXAB.

Write a program for Leonard that decodes the messages Sheldon sends.

Input

The input consists of two lines. The first line contains the positive integer KK (K<10K < 10), used to compute the shift value. The second line contains the word: a sequence of uppercase letters of length at most 20.

Output

Output the decoded word of uppercase letters.

Examples2

  1. Example 1

    Input
    5
    JTUSUKG
    
    Expected output
    BIGBANG
    
  2. Example 2

    Input
    3
    FXAB
    
    Expected output
    ZOOM