288A.md (1699B)
1 Source: https://codeforces.com/problemset/problem/288/A 2 3 A. Polo the Penguin and Strings 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Little penguin Polo adores strings. But most of all he adores strings of length *n*. 22 23 One day he wanted to find a string that meets the following conditions: 24 25 1. The string consists of *n* lowercase English letters (that is, the string's length equals *n*), exactly *k* of these letters are distinct. 26 2. No two neighbouring letters of a string coincide; that is, if we represent a string as *s* = *s*1*s*2... *s**n*, then the following inequality holds, *s**i* ≠ *s**i* + 1(1 ≤ *i* < *n*). 27 3. Among all strings that meet points 1 and 2, the required string is lexicographically smallest. 28 29 Help him find such string or state that such string doesn't exist. 30 31 String *x* = *x*1*x*2... *x**p* is lexicographically less than string *y* = *y*1*y*2... *y**q*, if either *p* < *q* and *x*1 = *y*1, *x*2 = *y*2, ... , *x**p* = *y**p*, or there is such number *r* (*r* < *p*, *r* < *q*), that *x*1 = *y*1, *x*2 = *y*2, ... , *x**r* = *y**r* and *x**r* + 1 < *y**r* + 1. The characters of the strings are compared by their ASCII codes. 32 33 Input 34 35 A single line contains two positive integers *n* and *k* (1 ≤ *n* ≤ 106, 1 ≤ *k* ≤ 26) — the string's length and the number of distinct letters. 36 37 Output 38 39 In a single line print the required string. If there isn't such string, print "-1" (without the quotes). 40 41 Examples 42 43 Input 44 45 ``` 46 7 4 47 ``` 48 49 Output 50 51 ``` 52 ababacd 53 ``` 54 55 Input 56 57 ``` 58 4 7 59 ``` 60 61 Output 62 63 ``` 64 -1 65 ```