Under construction

Still being built. Things may change

Letters and Scales

Interview

Time limit2sMemory limit1024 MB

Summary
Given n scales and a word s, find the minimum number of cubes needed to show s on the scales in a row, or report Impossible.
Level

Easy1 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Little Petya received an unusual New Year present: a set of scales and cubes. These scales do not show weight. Instead, they show letters. An empty scale shows nothing, one cube shows aa, two cubes show bb, and 26 cubes show zz. If more than 26 cubes are put on a scale, it breaks.

Petya played with the cubes and scales for a long time. He broke some scales and lost some cubes. He now has nn scales in total. Petya wants the scales, placed in a row, to show the word ss, but he does not know whether that is possible. Help him. Write a program that, given nn and the word ss, finds the minimum number of cubes needed to show ss, or reports that it is impossible.

Input

The first line contains one integer nn (1≤n≤1001 \le n \le 100). The second line contains the word ss, consisting of lowercase Latin letters. The length of ss does not exceed 100.

Output

If the word cannot be written, print the single word Impossible. Otherwise, print one integer: the minimum number of cubes needed to write ss with the scales and cubes.

Examples2

  1. Example 1

    Input
    20
    impossible
    
    Expected output
    119
    
  2. Example 2

    Input
    5
    impossible
    
    Expected output
    Impossible