package main

import (
	"fmt"
)

var flag int

func combination(num []byte, n, k int, result []byte) int {
	if flag != 0 {
		return 0
	}
	for i := n; i < len(num); i++ {
		// use temp to save the origin sequence.
		temp := make([]byte, len(num)-n)
		copy(temp, num[n:])
		num[n], num[i] = num[i], num[n]
		result[n] = num[n]
		if n == len(num)-1 {
			flag = match(k, string(result))
			if flag != 0 {
				fmt.Println(string(result))
			}
		}
		combination(num, n+1, k, result)
		//recover sequence.
		copy(num[n:], temp)
	}
	return flag
}
func next(str string) []int {
	var i, j int
	next := make([]int, len(str)+1)
	next[0] = -1
	j = -1
	for i = 0; i < len(str); {
		if j == -1 || str[i] == str[j] {
			i++
			j++
			next[i] = j
		} else {
			j = next[j]
		}
	}
	return next
}
func match(k int, str string) int {
	next := next(str)
	if next[len(str)]%(len(str)-next[len(str)]) == 0 && len(str)/(len(str)-next[len(str)]) == k {
		return 1
	} else {
		return 0
	}
}
func main() {
	var k int
	var str string
	fmt.Scanln(&k)
	fmt.Scanln(&str)
	res := make([]byte, len(str))
	flag = combination([]byte(str), 0, k, res)
	if flag == 0 {
		fmt.Println(-1)
	}
}


package main

import (
	"fmt"
)

var flag int

func isSwap(num []byte, start, end int) bool {
	for i := start; i < end; i++ {
		if num[i] == num[end] {
			return false
		}
	}
	return true
}

func combination(num []byte, n, k int) int {
	if flag != 0 {
		return flag
	}
	if n == len(num)-1 {
		flag = match(k, string(num))
		if flag != 0 {
			fmt.Println(string(num))
			return flag
		}
	}
	for i := n; i < len(num); i++ {
		// use temp to save the origin sequence.
		temp := make([]byte, len(num)-n)
		if n == i {
			combination(num, n+1, k)
		} else {
			if !isSwap(num, n, i) {
				continue
			} else {
				copy(temp, num[n:])
				num[n], num[i] = num[i], num[n]
				combination(num, n+1, k)
				//recover sequence.
				copy(num[n:], temp)
			}
		}
	}
	return flag
}
func next(str string) []int {
	var i, j int
	next := make([]int, len(str)+1)
	next[0] = -1
	j = -1
	for i = 0; i < len(str); {
		if j == -1 || str[i] == str[j] {
			i++
			j++
			next[i] = j
		} else {
			j = next[j]
		}
	}
	return next
}
func match(k int, str string) int {
	next := next(str)
	if next[len(str)]%(len(str)-next[len(str)]) == 0 && len(str)/(len(str)-next[len(str)]) == k {
		return 1
	} else {
		return 0
	}
}
func main() {
	var k int
	var str string
	fmt.Scanln(&k)
	fmt.Scanln(&str)
	flag = combination([]byte(str), 0, k)
	if flag == 0 {
		fmt.Println(-1)
	}
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"regexp"
)

func main() {
	var k int
	if _, err := fmt.Scanf("%d\n", &k); err != nil {
		return
	}

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(s, "")
		if k == 1 {
			fmt.Println(s)
			return
		}

		dict := make(map[byte]int)
		for i := 0; i < len(s); i++ {
			dict[s[i]] = dict[s[i]] + 1
		}

		var sub_string []byte

		for l, v := range dict {
			if v%k != 0 {
				fmt.Println(-1)
				return
			} else {
				for i := 0; i < v/k; i++ {
					sub_string = append(sub_string, l)
				}
			}
		}

		for i := 0; i < k; i++ {
			fmt.Printf("%s", string(sub_string))
		}
		fmt.Println()
	}
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"regexp"
)

func main() {
	var k int
	if _, err := fmt.Scanf("%d\n", &k); err != nil {
		return
	}

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(s, "")
		if k == 1 {
			fmt.Println(s)
			return
		}

		if len(s)%2 != 0 {
			fmt.Println(-1)
		} else {
			dict := make(map[byte]int)
			for i := 0; i < len(s); i++ {
				dict[s[i]] = dict[s[i]] + 1
			}

			var sub_string []byte

			for l, v := range dict {
				if v%k != 0 {
					fmt.Println(-1)
					return
				} else {
					for i := 0; i < v/k; i++ {
						sub_string = append(sub_string, l)
					}
				}
			}

			for i := 0; i < k; i++ {
				fmt.Printf("%s", string(sub_string))
			}
			fmt.Println()
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"regexp"
)

func main() {
	var k int
	if _, err := fmt.Scanf("%d\n", &k); err != nil {
		return
	}

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(s, "")

		if len(s)%2 != 0 {
			fmt.Println(-1)
		} else {
			dict := make(map[byte]int)
			for i := 0; i < len(s); i++ {
				dict[s[i]] = dict[s[i]] + 1
			}

			var sub_string []byte

			for l, v := range dict {
				if v%k != 0 {
					fmt.Println(-1)
					return
				} else {
					for i := 0; i < v/k; i++ {
						sub_string = append(sub_string, l)
					}
				}
			}

			for i := 0; i < k; i++ {
				fmt.Printf("%s", string(sub_string))
			}
			fmt.Println()
		}
	}
}


package main

import "fmt"

func main() {
    var k int
    var s string
    var char [26]int
    fmt.Scan(&k)
    fmt.Scan(&s)
    for _, v := range s { char[v-'a']++ }
    if len(s)%k == 0 {
        ans := true
        for i := 0; i < 26; i++ {
            if char[i] % k != 0 {
                ans = false
                break
            }
        }
        if !ans {
            fmt.Println(-1)
        } else {
            ns := ""
            for i := 0; i < 26; i++ {
                for j := 0; j < char[i]/k; j++ {
                    ns += string(i+'a')
                }
            }
            for ; k > 0; k-- { fmt.Print(ns) }
            fmt.Println()
        }
    } else {
        fmt.Println(-1)
    }
}


package main

import (
    "fmt"
)

func main() {
    var k int
    var str string
    fmt.Scanf("%d\n", &k)
    fmt.Scanf("%s\n", &str)
    D := make(map[int]int)
    for _, v := range str {
        D[int(v)]++
    }
    for _, v := range D {
        if v%k != 0 {
            fmt.Printf("-1\n")
            return
        }
    }
    for j := 0; j < k; j++ {
        for A := 0x61; A <= 0x7A; A++ {
            v := D[A]
            for i := 0; i < v/k; i++ {
                fmt.Printf("%c", A)
            }
        }
    }
    fmt.Print("\n")

}


package main

import (
    "fmt"
)

func main() {
    var k int
    var str string
    fmt.Scanf("%d\n", &k)
    fmt.Scanf("%s\n", &str)
    D := make(map[int]int)
    for _, v := range str {
        D[int(v)]++
    }
    for _, v := range D {
        if v%k != 0 {
            fmt.Printf("-1\n")
            return
        }
    }
    for j := 0; j < k; j++ {
        for K, v := range D {
            for i := 0; i < v/k; i++ {
                fmt.Printf("%c", K)
            }
        }
    }
    fmt.Print("\n")

}


package main
import (
	"fmt"
	"unicode/utf8"
)

func main() {
	var k int
	flag:=false
	var x string
	n:=make([]int,27)
	fmt.Scan(&k,&x)
	len:= utf8.RuneCountInString(x)
	for i:=0; i<len;i++ {
		n[int(x[i]-'a'+1)]++
	}
	for i:=1; i<=26;i++ {
			if n[i]%k!=0{
				fmt.Println("-1")
				flag=true
				break
			}
	}
	if flag==false {
		for q:=1;q<=k;q++ {
			for i:=1;i<=26;i++ {
				for j:=1;j<=n[i]/k;j++ {
					fmt.Print(string(i+'a'-1))
				}
			}
		}
	}
	fmt.Println()
}


// 219A
package main

import (
	"fmt"
)

func main() {
	var k int
	fmt.Scan(&k)
	var input, output string
	fmt.Scan(&input)
	var letters [26]int
	for _, u := range input {
		letters[u-'a']++
	}
	for u := 0; u < 26; u++ {
		if letters[u] == 0 {
			continue
		} else if letters[u]%k != 0 {
			for v := 0; v < letters[u]/k; v++ {
				output += string('a') + string(u)
			}
		} else {
			output = "-1"
			break
		}
	}
	if output == "-1" {
		fmt.Println(output)
	} else {
		for u := 0; u < k; u++ {
			fmt.Print(output)
		}
		fmt.Println()
	}
}


mport (
	"fmt"
	"unicode/utf8"
)

func main() {
	var k int
	flag:=false
	var x string
	n:=make([]int,27)
	fmt.Scan(&k,&x)
	len:= utf8.RuneCountInString(x)
	for i:=0; i<len;i++ {
		n[int(x[i]-'a'+1)]++
	}
	for i:=1; i<=26;i++ {
			if n[i]%k!=0{
				fmt.Println("-1")
				flag=true
				break
			}
	}
	if flag==false {
		for q:=1;q<=k;q++ {
			for i:=1;i<=26;i++ {
				for j:=1;j<=n[i]/k;j++ {
					fmt.Print(string(i+'a'-1))
				}
			}
		}
	}
	fmt.Println()
}


package main

import (
	"fmt"
)

func solve(k int, s string) string {
	length := len(s)
	if length%k != 0 {
		return "-1"
	}

	counts := make([]int, 26, 26)
	for i := 0; i < length; i++ {
		counts[s[i]-'a']++
	}

	n := length / k
	tmp := ""
	for i := 0; i < 26; i++ {
		if counts[i] == 0 {
			continue
		}
		if counts[i]%k != 0 {
			return "-1"
		}
		for j := 0; j < counts[i]/n; j++ {
			tmp += string(i + 'a')
		}
	}

	ans := ""
	for i := 0; i < n; i++ {
		ans += tmp
	}

	return ans
}

func main() {
	var k int
	fmt.Scan(&k)

	var s string
	fmt.Scan(&s)

	fmt.Println(solve(k, s))
}


package main

import (
	"fmt"
)

func solve(k int, s string) string {
	length := len(s)
	if length%k != 0 {
		return "-1"
	}

	counts := make([]int, 26, 26)
	for i := 0; i < length; i++ {
		counts[s[i]-'a']++
	}

	n := length / k
	tmp := ""
	for i := 0; i < 26; i++ {
		if counts[i] == 0 {
			continue
		}
		if counts[i] != n {
			return "-1"
		}
		tmp += string(i + 'a')
	}

	ans := ""
	for i := 0; i < n; i++ {
		ans += tmp
	}

	return ans
}

func main() {
	var k int
	fmt.Scan(&k)

	var s string
	fmt.Scan(&s)

	fmt.Println(solve(k, s))
}


package main

import (
	"fmt"
)

func solve(k int, s string) string {
	length := len(s)
	if length%k != 0 {
		return "-1"
	}

	counts := make([]int, 26, 26)
	for i := 0; i < length; i++ {
		counts[s[i]-'a']++
	}

	n := length / k
	tmp := ""
	for i := 0; i < 26; i++ {
		if counts[i] == 0 {
			continue
		}
		if counts[i]%n != 0 {
			return "-1"
		}
		for j := 0; j < counts[i]/n; j++ {
			tmp += string(i + 'a')
		}
	}

	ans := ""
	for i := 0; i < n; i++ {
		ans += tmp
	}

	return ans
}

func main() {
	var k int
	fmt.Scan(&k)

	var s string
	fmt.Scan(&s)

	fmt.Println(solve(k, s))
}


package main

import (
	"fmt"
)

func solve(k int, s string) string {
	length := len(s)
	if length%k != 0 {
		return "-1"
	}

	counts := make([]int, 26, 26)
	for i := 0; i < length; i++ {
		counts[s[i]-'a']++
	}

	tmp := ""
	for i := 0; i < 26; i++ {
		if counts[i] == 0 {
			continue
		}
		if counts[i]%k != 0 {
			return "-1"
		}
		for j := 0; j < counts[i]/k; j++ {
			tmp += string(i + 'a')
		}
	}

	ans := ""
	for i := 0; i < length/len(tmp); i++ {
		ans += tmp
	}

	return ans
}

func main() {
	var k int
	fmt.Scan(&k)

	var s string
	fmt.Scan(&s)

	fmt.Println(solve(k, s))
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var (
		count int
		str   string
	)

	fmt.Scanf("%d\n", &count)
	charMap := make(map[rune]int)

	fmt.Scan(&str)
	for i := 0; i < len(str); i++ {
		charMap[rune(str[i])]++
	}

	fragment := make([]rune, 0)
	for char, amount := range charMap {
		if amount % count != 0 {
			fmt.Println(-1)
			return
		}
		for i := amount / count; i >= 1; i-- {
			fragment = append(fragment, char)
		}
	}

	result := strings.Repeat(string(fragment), count)

	fmt.Println(result)
}


package main
import (
    "fmt"
    "unicode/utf8"
)

func main() {
    var k int
    flag:=false
    var x string
    n:=make([]int,27)
    fmt.Scan(&k,&x)
    len:= utf8.RuneCountInString(x)
    for i:=0; i<len;i++ {
        n[int(x[i]-'a'+1)]++
    }
    for i:=1; i<=26;i++ {
            if n[i]%k!=0{
                fmt.Println("-1")
                flag=true
                break
            }
    }
    if flag==false {
        for q:=1;q<=k;q++ {
            for i:=1;i<=26;i++ {
                for j:=1;j<=n[i]/k;j++ {
                    fmt.Print(string(i+'a'-1))
                }
            }
        }
    }
    fmt.Println()
}


package main

import "fmt"

func main() {
	var k int
	var s string
	fmt.Scanf("%d\n%s", &k, &s)
	cnt := [26]int{}
	for _, c := range s {
		cnt[c - 'a']++
	}
	for _, v := range cnt {
		if v % k != 0 {
			fmt.Println(-1)
			return
		}
	}
	for i := 0; i < k; i++ {
		for j := 0; j < 26; j++ {
			for z := 0; z < cnt[j] / k; z++ {
				fmt.Print(string('a' + j));
			}
		}
	}
}


<?php
$a = trim(fgets(STDIN));
$b = trim(fgets(STDIN));
$c = array();
$d = array();
$e = array();
if($a == 1)
{
    print $b;
}
elseif(strlen($b) % $a != 0)
{
    print "-1";
}
else
{
    for($x = 0; $x < strlen($b); $x++)
    {
        array_push($c, $b[$x]);
    }
    $d = array_unique($c);
    if(count($c) / count($d) == $a)
    {
        for($y = 1; $y <= $a; $y++)
        {
            array_push($e, implode($d));
        }
        print implode($e);
    }
    else
    {
        print "-1";
    }
}
?>


<?php
$a = trim(fgets(STDIN));
$b = trim(fgets(STDIN));
$c = array();
$d = array();
$e = array();
$n = array();
$f = 0;
$g = 0;
if($a == 1)
{
    print $b;
}
elseif(strlen($b) % $a != 0)
{
    print "-1";
}
else
{
    for($x = 0; $x < strlen($b); $x++)
    {
        array_push($c, $b[$x]);
    }
    $d = array_unique($c);
    for($y = 1; $y <= $a; $y++)
    {
        array_push($e, implode($d));
    }
    $k = implode($e);
    for($x = 0; $x < strlen($k); $x++)
    {
        array_push($n, $k[$x]);
    }
    for($z = 0; $z < count($c); $z++)
    {
        $f = ord($c[$z]);
        $h += $f;
        $g = ord($n[$z]);
        $i += $g;
    }
    if($h != $i)
    {
        print "-1";
    }
    elseif(count($c) / count($d) == $a)
    {
        print implode($n);
    }
    else
    {
        print "-1";
    }
}
?>


<?php
    $k = intval(trim(fgets(STDIN)));
    $alph = str_split(trim(fgets(STDIN)));

    $count = array();

    foreach ($alph as $value) {
        if (array_key_exists($value, $count))
                $count[$value] += 1;
        else
            $count[$value] = 1;
    }

    $str = "";
    for ($i = 0; $i < $k; ++$i) {
        foreach ($count as $key => $val) {
            if ($val % $k != 0) {
                echo -1;
                die();
            }

            for ($j = 0; $j < $val / $k; ++$j) {
                $str = $str.$key;
            }
        }
    }

    echo $str;
?>


<?
$k = fgets(STDIN);
$s = fgets(STDIN);
$s_arr = str_split($s);
foreach($s_arr as $v){++$chr[$v];}
for($y=0;$y<$k;$y++){
foreach($chr as $ck => $cv){
if($cv%$k==0){
for($i=0;$i<($cv/$k);$i++){$w .=$ck;}
}
else{$w = -1;break;}
}
}
echo $w;
?>


<?
$k = fgets(STDIN);
$s = trim(fgets(STDIN));
$s_arr = str_split($s);
foreach($s_arr as $v){++$chr[$v];}
for($y=0;$y<$k;$y++){
    foreach($chr as $ck => $cv){
        if($cv%$k==0){
        for($i=0;$i<($cv/$k);$i++){$w .=$ck;}
        }
        else{$w = -1;break;}
    }
}
echo $w;
?>


<?
$k = fgets(STDIN);
$s = trim(fgets(STDIN));
$s_arr = str_split($s);
foreach($s_arr as $v){++$chr[$v];}
for($y=0;$y<$k;$y++){
    foreach($chr as $ck => $cv){
        if($cv%$k==0){
        for($i=0;$i<($cv/$k);$i++){$w .=$ck;}
        }
        else{$w = -1;break;}
    }
}
echo $cv;
?>


<?
$k = fgets(STDIN);
$s = fgets(STDIN);
$s_arr = str_split($s);
foreach($s_arr as $v){++$chr[$v];}
for($y=0;$y<$k;$y++){
    foreach($chr as $ck => $cv){
        if($cv%$k==0){
        for($i=0;$i<($cv/$k);$i++){$w .=$ck;}
        }
        else{$w = -1;break;}
    }
}
echo $cv;
?>


from collections import Counter

def solve(str,k):
    mp = Counter(str)
    #print mp
    kstring = ""
    for key,val in mp.iteritems():
        if(val%k!=0):
            return -1
        else:
            #print val
            kstring += key*(val/k)

    #print result
    result = ""
    for i in range(0,k):
        result += kstring

    return result

if __name__ == "__main__":
    k = int(raw_input())
    str = raw_input()

    print solve(str,k)


from __future__ import division, print_function

def main():
    # Template 1.0
    import sys, re
    from collections import deque, defaultdict, Counter, OrderedDict
    from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
    from heapq import heappush, heappop, heapify, nlargest, nsmallest
    def STR():
        return list(input())

    def INT():
        return int(input())

    def MAP():
        return map(int, input().split())

    def LIST():
        return list(map(int, input().split()))

    def list2d(a, b, c):
        return [[c] * b for i in range(a)]

    def sortListWithIndex(listOfTuples, idx):
        return (sorted(listOfTuples, key=lambda x: x[idx]))

    def sortDictWithVal(passedDic):
        temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
        toret = {}
        for tup in temp:
            toret[tup[0]] = tup[1]
        return toret

    def sortDictWithKey(passedDic):
        return dict(OrderedDict(sorted(passedDic.items())))

    INF = float('inf')
    mod = 10 ** 9 + 7

    k = INT()

    s = input()

    n = len(s)

    if(n%k!=0):
        print(-1)
    else:
        occ = defaultdict(int)
        for ch in s:
            occ[ch]+=1
        ans = 0
        for key in occ:
            if(occ[key]%k!=0):
                ans = -1
                break
        if(ans!=-1):
            ANS = [""]*k
            for key in occ:
                temp = occ[key]//k
                for i in range(k):
                    ANS[i]+=str(key)*temp
            print("".join(ANS))
        else:
            print(-1)

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip

    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys

class ostream:
    def __lshift__(self, a):
        sys.stdout.write(str(a))
        return self

cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero=0):
    conv = ord if py2 else lambda x: x
    A = [];
    numb = zero;
    sign = 1;
    i = 0;
    s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0'[0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-'[0]:
                sign = -1
            elif s[i] != b'\r'[0]:
                A.append(sign * numb)
                numb = zero;
                sign = 1
            i += 1
    except:
        pass
    if s and s[-1] >= b'0'[0]:
        A.append(sign * numb)
    return A

if __name__ == "__main__":
    main()


from __future__ import division, print_function

def main():
    k = int(input())
    s = input()
    f, b = Counter(s), []
    for x in set(s):
        if f[x] % k != 0:
            print(-1)
            return

        b.append(x * (f[x] // k))

    print(''.join(b * k))

# PyPy 2 Fast IO
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Importing Modules
import math
import collections

from collections import Counter
from math import fabs

if __name__ == "__main__":
    main()


n=int(input())
s=raw_input()

d={}

def count_c(i, s):
    c=0
    for x in s:
        if x==i:
            c=c+1
    return c

for i in s:
    d.update({i:count_c(i, s)})

f=1

for i in d:
    if d[i]%n!=0:
        f=0

if(f):
    s1=""
    for i in d:
        x=d[i]/n
        while x:
            s1=s1+i
            x-=1
    s2=""
    while n:
        s2=s2+s1
        n-=1
    print s2

else:
    print "-1"


"""
// Author : snape_here - Susanta Mukherjee

"""

from __future__ import division, print_function

import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def read():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')

import math

from itertools import permutations

mod=100000007

# Python3 code to find largest prime
# factor of number
import math

# A function to find largest prime factor
def maxPrimeFactors (n):

    # Initialize the maximum prime factor
    # variable with the lowest one
    maxPrime = -1

    # Print the number of 2s that divide n
    while n % 2 == 0:
        maxPrime = 2
        n >>= 1     # equivalent to n /= 2

    # n must be odd at this point,
    # thus skip the even numbers and
    # iterate only for odd integers
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            maxPrime = i
            n = n / i

    # This condition is to handle the
    # case when n is a prime number
    # greater than 2
    if n > 2:
        maxPrime = n

    return maxPrime

# Python3 program to find the most
# frequent element in an array.
import math as mt

def mostFrequent(arr, n):

    # Sort the array
    arr.sort()

    # find the max frequency using
    # linear traversal
    max_count = 1; res = arr[0]; curr_count = 1

    for i in range(1, n):
        if (arr[i] == arr[i - 1]):
            curr_count += 1

        else :
            if (curr_count > max_count):
                max_count = curr_count
                res = arr[i - 1]

            curr_count = 1

    # If last element is most frequent
    if (curr_count > max_count):

        max_count = curr_count
        res = arr[n - 1]

    return res

def main():

    k=ii()
    s=si()
    h=[0]*26
    for i in range(len(s)):
        h[ord(s[i])-97]+=1
    for i in range(26):
        if h[i]%k!=0:
            print(-1)
            exit()
    x=[0]*26
    for i in range(26):
        x[i]=h[i]//k
    ans=""
    for i in range(k):
        for i in range(26):
            if h[i]:
                ans+=x[i]*(chr(i+97))
                h[i]-=x[i]
    print(ans)

# region fastio#

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    #read()
    main()
#Comment read()


"""
// Author : snape_here - Susanta Mukherjee

"""

from __future__ import division, print_function

import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def read():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')

import math

from itertools import permutations

mod=100000007

# Python3 code to find largest prime
# factor of number
import math

# A function to find largest prime factor
def maxPrimeFactors (n):

    # Initialize the maximum prime factor
    # variable with the lowest one
    maxPrime = -1

    # Print the number of 2s that divide n
    while n % 2 == 0:
        maxPrime = 2
        n >>= 1     # equivalent to n /= 2

    # n must be odd at this point,
    # thus skip the even numbers and
    # iterate only for odd integers
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            maxPrime = i
            n = n / i

    # This condition is to handle the
    # case when n is a prime number
    # greater than 2
    if n > 2:
        maxPrime = n

    return maxPrime

# Python3 program to find the most
# frequent element in an array.
import math as mt

def mostFrequent(arr, n):

    # Sort the array
    arr.sort()

    # find the max frequency using
    # linear traversal
    max_count = 1; res = arr[0]; curr_count = 1

    for i in range(1, n):
        if (arr[i] == arr[i - 1]):
            curr_count += 1

        else :
            if (curr_count > max_count):
                max_count = curr_count
                res = arr[i - 1]

            curr_count = 1

    # If last element is most frequent
    if (curr_count > max_count):

        max_count = curr_count
        res = arr[n - 1]

    return res

def main():

    k=ii()
    s=si()
    h=[0]*26
    for i in range(len(s)):
        h[ord(s[i])-97]+=1
    for i in range(26):
        if h[i]%k!=0:
            print(-1)
            exit()
    for i in range(26):
        if h[i]:
            x=h[i]//k
            break
    ans=""
    for i in range(k):
        for i in range(26):
            if h[i]:
                ans+=x*(chr(i+97))
                h[i]-=x
    print(ans)

# region fastio#

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    #read()
    main()
#Comment read()


"""
// Author : snape_here - Susanta Mukherjee

"""

from __future__ import division, print_function

import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def read():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')

import math

from itertools import permutations

mod=100000007

# Python3 code to find largest prime
# factor of number
import math

# A function to find largest prime factor
def maxPrimeFactors (n):

    # Initialize the maximum prime factor
    # variable with the lowest one
    maxPrime = -1

    # Print the number of 2s that divide n
    while n % 2 == 0:
        maxPrime = 2
        n >>= 1     # equivalent to n /= 2

    # n must be odd at this point,
    # thus skip the even numbers and
    # iterate only for odd integers
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            maxPrime = i
            n = n / i

    # This condition is to handle the
    # case when n is a prime number
    # greater than 2
    if n > 2:
        maxPrime = n

    return maxPrime

# Python3 program to find the most
# frequent element in an array.
import math as mt

def mostFrequent(arr, n):

    # Sort the array
    arr.sort()

    # find the max frequency using
    # linear traversal
    max_count = 1; res = arr[0]; curr_count = 1

    for i in range(1, n):
        if (arr[i] == arr[i - 1]):
            curr_count += 1

        else :
            if (curr_count > max_count):
                max_count = curr_count
                res = arr[i - 1]

            curr_count = 1

    # If last element is most frequent
    if (curr_count > max_count):

        max_count = curr_count
        res = arr[n - 1]

    return res

def main():

    k=ii()
    s=si()
    h=[0]*26
    for i in range(len(s)):
        h[ord(s[i])-97]+=1
    for i in range(26):
        if h[i]%k!=0:
            print(-1)
            exit()
    ans=""
    for i in range(k):
        for i in range(26):
            if h[i]:
                ans+=chr(i+97)
                h[i]-=1
    print(ans)

# region fastio#

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    #read()
    main()
#Comment read()


k = input()
s = sorted(list(raw_input()))

res = [[] for i in range(k)]

if len(s) % k != 0:
    print -1
else:

    while s:
        for j in res:
            t = s.pop(0)
            j.append(t)

    if res and res.count(res[0]) == k:
        print ''.join(res[0]) * k
    else:
        print -1


"""Template for Python Competitive Programmers prepared by Mayank Chaudhary aka chaudhary_19"""

# to use the print and division function of Python3
from __future__ import division, print_function

"""value of mod"""
MOD = 10 ** 9 + 7

"""use resource"""
# import resource
# resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])

"""uncomment next 4 lines while doing recursion based question"""
# import threading
# threading.stack_size(2**27)
import sys

# sys.setrecursionlimit(10**6)

"""uncomment next 7 lines while doing nCr question"""
# fact=[1]
# for i in range(1,100001):
#    fact.append((fact[-1]*i)%mod)
# ifact=[0]*100001
# ifact[100000]=pow(fact[100000],mod-2,mod)
# for i in range(100000,0,-1):
#    ifact[i-1]=(i*ifact[i])%mod

"""uncomment modules according to your need"""
from bisect import bisect_left, bisect_right, insort
# import itertools
# import collections
# import math
# import heapq
# from random import randint as rn
# from Queue import Queue as Q

'''
def modinv(n, p):
    return pow(n, p - 2, p)
'''

'''
def ncr(n, r, p):  # for using this uncomment the lines calculating fact and ifact
    t = ((fact[n]) * ((ifact[r] * ifact[n - r]) % p)) % p
    return t
'''

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()

'''
def GCD(x, y):
    while (y):
        x, y = y, x % y
    return x
'''

"""*******************************************************"""

def get_xor(n):
    return [n,1,n+1,0][n%4]

def main():

    n = int(input())
    string = input()

    mydict = dict()
    for i in string:
        mydict[i] = mydict.get(i, 0)+1

    flag = 0
    ans = ''
    for i in mydict:
        if mydict[i]%n==0:
            ans += i*(mydict[i]//n)
        else:
            flag = 1
            break

    if flag:
        print(-1)
    else:
        print(ans*n)

""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip

    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

""" main function"""

if __name__ == '__main__':
    main()
# threading.Thread(target=main).start()


"""Template for Python Competitive Programmers prepared by Mayank Chaudhary aka chaudhary_19"""

# to use the print and division function of Python3
from __future__ import division, print_function

"""value of mod"""
MOD = 10 ** 9 + 7

"""use resource"""
# import resource
# resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])

"""uncomment next 4 lines while doing recursion based question"""
# import threading
# threading.stack_size(2**27)
import sys

# sys.setrecursionlimit(10**6)

"""uncomment next 7 lines while doing nCr question"""
# fact=[1]
# for i in range(1,100001):
#    fact.append((fact[-1]*i)%mod)
# ifact=[0]*100001
# ifact[100000]=pow(fact[100000],mod-2,mod)
# for i in range(100000,0,-1):
#    ifact[i-1]=(i*ifact[i])%mod

"""uncomment modules according to your need"""
from bisect import bisect_left, bisect_right, insort
# import itertools
# import collections
# import math
# import heapq
# from random import randint as rn
# from Queue import Queue as Q

'''
def modinv(n, p):
    return pow(n, p - 2, p)
'''

'''
def ncr(n, r, p):  # for using this uncomment the lines calculating fact and ifact
    t = ((fact[n]) * ((ifact[r] * ifact[n - r]) % p)) % p
    return t
'''

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()

'''
def GCD(x, y):
    while (y):
        x, y = y, x % y
    return x
'''

"""*******************************************************"""

def get_xor(n):
    return [n,1,n+1,0][n%4]

def main():

    n = int(input())
    string = input()

    mydict = dict()
    for i in string:
        mydict[i] = mydict.get(i, 0)+1

    flag = 0
    ans = []
    for i in mydict:
        if mydict[i]%n==0:
            ans += [i*(mydict[i]//n)]
        else:
            flag = 1
            break

    if flag:
        print(-1)
    else:
        print(''.join(ans*n))

""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip

    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

""" main function"""

if __name__ == '__main__':
    main()
# threading.Thread(target=main).start()


#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil, factorial
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
from fractions import Fraction
from functools import reduce
import string
import sys
import os
import re
inf = float('inf')
mod_ = int(1e9) + 7
mod = 998244353

def factors(n):
    from functools import reduce
    return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

def sieve():
    n,m=1,10**6
    primes = {}
    arr=set([])
    for i in range(2, round(m ** 0.5) + 1):
        a = n // i
        b = m // i
        for k in range(max(2, a), b + 1):
            c = i * k
            primes[c] = 1

    for i in range(max(n, 2), m + 1):
        if i not in primes:
            arr.add(i)

    return arr

def nc2(x):
    return (x*(x-1))//2
def main():
    k = int(input().strip())
    s = input().strip()
    freq = Counter(s)
    if any(i%k != 0 for i in freq.values()):
        print(-1)
    else:
        s = ''
        for letter in freq:
            s += letter*(freq[letter]//k)
        s *= k
        print(s)

# region fastio

BUFSIZE = 8192

class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()

class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()

def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


import sys
from collections import defaultdict

if __name__ == '__main__':
    k = int(raw_input())
    s = raw_input()

    if not len(s) % k == 0:
        print -1
        sys.exit()

    D = defaultdict(int)
    for letter in s:
        D[letter] += 1

    for letter, count in D.items():
        if not count % k == 0:
            print -1
            sys.exit()

    print ''.join(letter*(count/k) for letter, count in D.items()) * k


import sys
from collections import defaultdict

if __name__ == '__main__':
    k = int(raw_input())
    s = raw_input()

    if not len(s) % k == 0:
        print -1
        sys.exit()

    D = defaultdict(int)
    for letter in s:
        D[letter] += 1

    for letter, count in D.items():
        if not count % k == 0:
            print -1
            sys.exit()

    print ''.join(letter*(k/count) for letter, count in D.items()) * k


from __future__ import print_function, division
from collections import Counter
import sys
k = int(raw_input())
cnt = Counter(raw_input())

ans = []
for i in cnt.most_common():
    if i[1] % k != 0:
        print(-1)
        sys.exit(0)
    ans.extend([i[0]] * (i[1] // k))

print(''.join(ans) * k)


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int n,m,k,a[50000],h;

void dfs(int i,int t)
{
    if(i>m+n)return;
    int j,p;
    for(j=0;j<t;j++)
    {
        a[h++]=i;
    }
    p=i+m-1;
    if(p>m+n)return;
    a[h++]=p;
    dfs(i+m,k-1);
}

int main()
{
    int i;
    while(scanf("%d%d%d",&m,&n,&k)!=EOF)
    {
        if(k==1)
        {
            if(m==2)
            {
                printf("%d\n",m+n);
                for(i=1;i<m+n;i++)
                    printf("%d ",i);
                printf("%d\n",i);
            }
            else
            {
                if(n>=m-1)
                    printf("3\n");
                else
                    printf("2\n");
                printf("1 %d",m);
                if(n>=m-1)
                    printf(" %d\n",2*m-1);
                else
                    printf("\n");
            }
        }
        else
        {
            h=0;
            dfs(1,k);
            printf("%d\n",h);
            for(i=0;i<h-1;i++)
            {
                printf("%d ",a[i]);
            }
            printf("%d\n",a[i]);
        }

    }
    return 0;
}


/*#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<string>
#include<math.h>
using namespace std;
int main()
{
    int a,b,c;
    while(cin>>a>>b>>c)
    {
        cout<<a*c+a*b+b*c-a-b-c+1<<endl;
    }
	return 0;
}
*/
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int n,m,k,p,i,j;
    while(cin>>n>>m>>k)
    {
        if(k==1)
        {
            p=ceil(1.0*m/(n-1))*k+k;
            cout<<p<<endl;
            cout<<1;
            for(i=2;i<=k;++i)
            cout<<' '<<1;
            for(i=1;i*n-i+1<n+m+1;++i)
            {
                cout<<' '<<i*n-i+1;
            }
            cout<<endl;
            continue;
        }
        p=ceil(1.0*m/(n-1))*k+k;
        cout<<p<<endl;
        cout<<1;
        for(i=2;i<=k;++i)
        cout<<' '<<1;
        for(i=1;i*n<n+m+1;++i)
        {
            for(j=0;j<k;++j)
            cout<<' '<<i*n+j;
        }
        cout<<endl;
    }
    return 0;
}

/*sannhjbdbennfldkfdrsngicpftgbqstidfqestroedapgcnkm*/


#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;

const int inf = 0x3f3f3f3f;
const int maxn = 1009;
const double esp = 1e-6;

int a[1009];
int n, m, k;

void out(int aa)
{
    printf("%d\n", aa*k);
    int i, j;
    printf("1");
    for(i=0; i<aa; i++)
    {
        for( j=i==0?2:1; j<=k; j++ )
            printf(" %d", a[i]);
    }
    puts("");
}

int main()
{
    int i, j, aa;
    while(~scanf("%d%d%d", &n, &m, &k))
    {
        aa = 0;
        a[0] = 1;
//        if(n<m)
//        {
//            aa = m+1;
//            for(i=1; i<aa; i++) a[i] = a[i-1]+n;
//            out(aa);
//            continue;
//        }
        //else if(n==2 && n==1)
        while(a[aa]<m+n)
        {
            a[++aa] = a[aa-1]+n;
        }
        out(aa);
    }
	return 0;
}

/*lekbcbnibehrtstgllctdcpkhrtdgnbrsdlmeeafaapmsosbrb*/


#include"stdio.h"
int stuff[1000005];
int k_ren[2005]={0};
int main(){
    int n,m,k;
    int i,j,l;
    int sum,ren;
    scanf("%d%d%d", &n, &m, &k);
    sum=k;
    ren=k;
    k_ren[1]=k;
    for(i=1;i<=sum;i++)
        stuff[i]=1;
    for(i=n;i<=n+m+1;i++){
        if(i-n>=1){
            if(i-n==1){
                if(k_ren[i-n]!=0){
                    ren -= k_ren[i-n];
                    k_ren[i-1] = 1;
                    ren++;
                    sum++;
                }
            }
            else{
                ren -= k_ren[i-n];
            }
        }
        if(ren == 0){
            k_ren[i-1] = k - ren;
            sum += k - ren;
            ren = k;
        }
        else if(ren<k){
            k_ren[i] = k - ren;
            sum += k - ren;
            ren = k;
        }
    }
    printf("%d\n",sum);
    for(i=1;i<=n+m;i++){
        if(k_ren[i]!=0){
            for(j=1;j<=k_ren[i];j++){
                printf("%d",i);
                if(i!=n+m||j!=k_ren[i])
                    printf(" ");
                else printf("\n");
            }
        }
    }
    return 0;
}


/*#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<string>
#include<math.h>
using namespace std;
int main()
{
    int a,b,c;
    while(cin>>a>>b>>c)
    {
        cout<<a*c+a*b+b*c-a-b-c+1<<endl;
    }
	return 0;
}
*/
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int n,m,k,p,i,j;
    while(cin>>n>>m>>k)
    {

        if(k==1)
        {
   //         p=ceil(1.0*m/(n-1))*k+k;
            if((n+m)%(n-1)==0)
            p=(n+m)/(n-1)-1;
            else
            p=(n+m)/(n-1);
            cout<<p+1<<endl;
            cout<<1;
            for(i=2;i<=k;++i)
            cout<<' '<<1;
  //          for(i=1;i*n-i+1<n+m+1;++i)
            for(i=1;i<=p;++i)
            {
                cout<<' '<<i*n-i+1;
            }
            cout<<endl;
            continue;
        }
 //       p=ceil(1.0*m/(n-1))*k+k;
        if(m%n==0)
        {
            p=m/n+1;
            cout<<k+k*(p-1)+1<<endl;
            cout<<1;
            for(i=2;i<=k;++i)
            cout<<' '<<1;
            for(i=1;i<p;++i)
            {
                cout<<' '<<i*n;
                for(j=1;j<=k-1;++j)
                cout<<' '<<i*n+1;
            }
            cout<<' '<<p*n<<endl;
            continue;
        }

     //   p=k*(floor(1.0*(n+m+1)/n)+1);
        p=(n+m)/n;
        cout<<k+p*k<<endl;
        cout<<1;
        for(i=2;i<=k;++i)
        cout<<' '<<1;
        for(i=1;i<=p;++i)
        {
            cout<<' '<<i*n;
            for(j=0;j<k;++j)
            cout<<' '<<i*n+1;
        }
        cout<<endl;
    }
    return 0;
}

/*bsjhqgjthksjpsjlhdoolbbtolsdflptbqsjcaibkskrrtaqch*/


#include"stdio.h"
int k_ren[2005]={0};
int main(){
    int n,m,k;
    int i,j,l;
    long long  sum,ren;
    scanf("%d%d%d", &n, &m, &k);
    sum=k;
    ren=k;
    k_ren[1]=k;
    for(i=n;i<=n+m+1;i++){
        if(i==n+m+1){
            if(ren -= k_ren[i-n]!=0)
                break;
        }
        else if(i-n>=1){
            if(i-n==1){
                if(k_ren[i-n]!=0){
                    ren -= k_ren[i-n];
                    k_ren[i-1] = 1;
                    ren++;
                    sum++;
                }
            }
            else{
                ren -= k_ren[i-n];
            }
        }
        if(ren == 0){
            k_ren[i-1] = k - ren;
            sum += k - ren;
            ren = k;
        }
        else if(ren<k){
            k_ren[i] = k - ren;
            sum += k - ren;
            ren = k;
        }
    }
    printf("%I64d\n",sum);
    for(i=1;i<=n+m;i++){
        if(k_ren[i]!=0){
            for(j=1;j<=k_ren[i];j++){
                printf("%d",i);
                if(i!=n+m||j!=k_ren[i])
                    printf(" ");
                else printf("\n");
            }
        }
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define FOR(i,n) for(i=0;i<(n);i++)
#define CLR(a) memset(a,0,sizeof(a))
#define CIN(a) scanf("%d",&a)
using namespace std;
int main()
{
	int n,m,k,i;
	cin>>n>>m>>k;
	if(n==m)
    {
        FOR(i,k) printf("1 ");
        printf("%d ",n);
        FOR(i,k-1) printf("%d ",n+1);
        printf("%d",n+m);
        printf("\n");
    }
    else if(n-m==1)
    {
        FOR(i,k) printf("1 ");
        printf("%d ",n);
        FOR(i,k-1)  printf("%d ",n+1);
        printf("\n");

    }
    else
    {
        FOR(i,k) printf("1 ");
        FOR(i,k) printf("%d ",n);
        printf("\n");
    }
	return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
const int N=1000*10;
int n;
int m;
int k;
int hd[N];
int day[N];

int main()
{
    while(scanf("%d%d%d",&m,&n,&k)!=EOF)
    {
      int cnt=0;
      memset(day,0,sizeof(day));
      for(int i=1;i<(n+m+1);i++)
      {
        //cout<<day[i]<<" GG"<<endl;
        if(day[i]<k)
        {
//            cout<<"F"<<k-day[i]<<endl;
            int fuck=k-day[i];
            for(int t=0;t<fuck;t++)
              hd[cnt]=i,cnt++;

            for(int r=i;r<(i+m);r++)
             day[r]+=fuck;

//            for(int j=i;j<i+m;j++)
//             cout<<day[j]<<'a';
//             cout<<endl;
        }
        else if(day[i+1]==0)
        {
            hd[cnt]=i;
            cnt++;
            for(int t=i;t<i+m;t++)
            day[t]++;
        }
         //cout<<day[i]<<" EE"<<endl<<endl;
      }
      cout<<cnt<<endl;
      for(int i=0;i<cnt;i++)
       cout<<hd[i]<<' ';
       cout<<endl;
   }
  return 0;
}

/*mcsaijqrkadcqpofajcqfjjfnclknjdrdbjlkrbnkepgmblmcf*/


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,m,k,i,j;
    while(scanf("%d%d%d",&n,&m,&k)!=EOF)
    {
        if(n>m)
        {
            printf("%d\n",2*k);
            for(i=0;i<k;i++)
                printf("1 ");
            printf("%d",n);
            for(i=0;i<k-1;i++)
                printf(" %d",n+1);
        }
        else if(n==m)
        {
            printf("%d\n",2*k+1);
            for(i=0;i<k;i++)
                printf("1 ");
            printf("%d ",n);
            for(i=0;i<k-1;i++)
                printf("%d ",n+1);
            printf("%d",2*n-1);
        }
        printf("\n");
    }
    return 0;
}


#include"stdio.h"
int k_ren[2005]={0};
int main(){
    int n,m,k;
    int i,j,l;
    long long  sum,ren;
    scanf("%d%d%d", &n, &m, &k);
    sum=k;
    ren=k;
    k_ren[1]=k;
    for(i=n;i<=n+m+1;i++){
        if(i-n>=1){
            if(i-n==1){
                if(k_ren[i-n]!=0){
                    ren -= k_ren[i-n];
                    k_ren[i-1] = 1;
                    ren++;
                    sum++;
                }
            }
            else{
                ren -= k_ren[i-n];
            }
        }
        if(ren == 0){
            k_ren[i-1] = k - ren;
            sum += k - ren;
            ren = k;
        }
        else if(ren<k){
            k_ren[i] = k - ren;
            sum += k - ren;
            ren = k;
        }
    }
    printf("%I64d\n",sum);
    for(i=1;i<=n+m;i++){
        if(k_ren[i]!=0){
            for(j=1;j<=k_ren[i];j++){
                printf("%d",i);
                if(i!=n+m||j!=k_ren[i])
                    printf(" ");
                else printf("\n");
            }
        }
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define FOR(i,n) for(i=0;i<(n);i++)
#define CLR(a) memset(a,0,sizeof(a))
#define CIN(a) scanf("%d",&a)
using namespace std;
int main()
{
	int n,m,k,i;
	cin>>n>>m>>k;
	if(n==m)
    {
        printf("%d\n",k+1+k);
        FOR(i,k) printf("1 ");
        printf("%d ",n);
        FOR(i,k-1) printf("%d ",n+1);
        printf("%d",n+2);
        printf("\n");
    }
    else if(n-m==1)
    {
        if(k!=1)
        {
            printf("%d\n",k+k);
            FOR(i,k) printf("1 ");
            printf("%d ",n);
            FOR(i,k-1)  printf("%d ",n+1);
            printf("\n");
        }
        else
        {
            printf("%d\n",3);
            printf("1 %d %d\n",n,n+1);
        }
    }
    else
    {
        printf("%d\n",k+k);
        FOR(i,k) printf("1 ");
        FOR(i,k) printf("%d ",n);
        printf("\n");
    }
	return 0;
}


#include"stdio.h"
int k_ren[2005]={0};
int main(){
    int n,m,k;
    int i,j,l;
    long long  sum,ren;
    scanf("%d%d%d", &n, &m, &k);
    sum=k;
    ren=k;
    k_ren[1]=k;
    for(i=n;i<=n+m+1;i++){
        if(i==n+m+1){
            ren -= k_ren[i-n];
            if(ren!=0)
                break;
        }
        if(i-n>=1){
            if(i-n==1){
                if(k_ren[i-n]!=0){
                    ren -= k_ren[i-n];
                    k_ren[i-1] = 1;
                    ren++;
                    sum++;
                }
            }
            else{
                ren -= k_ren[i-n];
            }
        }
        if(ren == 0){
            k_ren[i-1] = k - ren;
            sum += k - ren;
            ren = k;
        }
        else if(ren<k){
            k_ren[i] = k - ren;
            sum += k - ren;
            ren = k;
        }
    }
    printf("%I64d\n",sum);
    for(i=1;i<=n+m;i++){
        if(k_ren[i]!=0){
            for(j=1;j<=k_ren[i];j++){
                printf("%d",i);
                if(i!=n+m||j!=k_ren[i])
                    printf(" ");
                else printf("\n");
            }
        }
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int n,m,k,a[50000],h;

void dfs(int i,int t,int p)
{
    if(i>m+n)return;
    int j,q;
    for(j=0;j<t;j++)
    {
        a[h++]=i;
    }
    if(p>=m+n)return;
    a[h++]=p;
    dfs(i+m,k-1,p+m-1);
}

int main()
{
    int i;
    while(scanf("%d%d%d",&m,&n,&k)!=EOF)
    {
        h=0;
        dfs(1,k,m);
        printf("%d\n",h);
        for(i=0;i<h-1;i++)
        {
            printf("%d ",a[i]);
        }
        printf("%d\n",a[i]);
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int m,n,k,j,sum,max,a[10001],i,sign=0,x;
    scanf("%d %d %d",&m,&n,&k);
    if(m>n)
    {
        printf("%d\n",2*k);
        for(x=0;x<k;x++)
        printf("1 ");
        for(x=0;x<k;x++)
        printf("%d ",m);
        printf("\n");
    }
    else if(m<=n)
    {
        sum=m;
        a[0]=sum;
        for(j=1;;j++)
        {
            sum=sum-1+m;
            a[j]=sum;
            if(sum+m==m+n)
            {
                max=(j+2)*k+1;
                sign=1;
                a[++j]=sum+m;
                break;
            }
            if(sum+m>m+n)
            {
                max=(j+2)*k;
                break;
            }
        }
        printf("%d\n",max);
        for(x=0;x<k;x++)
                printf("1 ");
        for(i=0;i<j;i++)
        {
            for(x=0;x<k;x++)
                printf("%d ",a[i]);
        }
        if(sign==1)printf("%d \n",a[j]);
        else
        {
            for(x=0;x<k;x++)
                printf("%d ",a[j]);
            printf("\n");
        }

    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(1)
    {
        if(val+x==x+y)
        {
            v[++nr]=val+2;
        break;
        }
        if(val+x>x+y+1)
        break;
        if(val+x==x+y+1&&k>1)break;
        if(val+x==x+y+1&&k==1)
        {
            v[++nr]=val+1;
            break;
        }
        val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(1)
    {
        if(val+x==x+y)
        {
            for(i=1;i<=k;i++)v[++nr]=val+2;
        break;
        }
        if(val+x>x+y+1)
        break;
        if(val+x==x+y+1&&k>1)break;
        if(val+x==x+y+1&&k==1)
        {
            v[++nr]=val+1;
            break;
        }
        val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(1)
    {
        if(val+x==x+y&&k!=1&&val!=1)
        {
            v[++nr]=val+2;
        break;
        }
        if(val+x>x+y+1)
        break;
        if(val+x==x+y+1&&k>1)break;
        if(val+x==x+y+1&&k==1)
        {
            v[++nr]=val+1;
            break;
        }
        val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(1)
    {
        if(val+x==x+y&&k!=1)
        {
            v[++nr]=val+2;
        break;
        }
        if(val+x>x+y+1)
        break;
        if(val+x==x+y+1&&k>1)break;
        if(val+x==x+y+1&&k==1)
        {
            v[++nr]=val+1;
            break;
        }
        val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(val<=y)
    {
        val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(val<=y)
    {
        if(val+x==x+y)
        {v[++nr]=val+2;
        break;
        }
        if(val+x>x+y)
        break;val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(val<=y)
    {
        if(val+x==x+y)
        {v[++nr]=val+2;
        break;
        }val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(1)
    {
        if(val+x==x+y)
        {v[++nr]=val+2;
        break;
        }
        if(val+x>x+y+1)
        break;
        if(val+x==x+y+1)
        {v[++nr]=val+1;
        break;}val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(1)
    {
        if(val+x==x+y&&k!=1)
        {
            v[++nr]=val+2;
        break;
        }
        if(val+x>x+y+1)
        break;
        if(val+x==x+y+1&&k>1)break;
        if(val+x==x+y+1&&k==1)
        {
            v[++nr]=val+1;
            break;
        }
        val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(val<=y)
    {
        val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int v[1000005];
int main()
{

    //freopen("a.in","r",stdin);
    int x , y , k ,ok =0,nr=0,i,val=1;
    scanf("%d%d%d",&x,&y,&k);
    for(i=1;i<=k;i++)v[++nr]=1;
    while(1)
    {
        if(val+x==x+y&&val!=1)
        {
            v[++nr]=val+2;
        break;
        }
        if(val+x>x+y+1)
        break;
        if(val+x==x+y+1&&k>1)break;
        if(val+x==x+y+1&&k==1)
        {
            v[++nr]=val+1;
            break;
        }
        val+=x-1;
        v[++nr]=val;
        for(i=1;i<=k-1;i++)v[++nr]=val+1;
    }
    printf("%d\n",nr);
    for(i=1;i<=nr;i++)printf("%d ",v[i]);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
vector<int> v;
int i;
int last = n;
v.push_back(1);
for(i=1;i<=n+m;i++)
{
if(i==last){
v.push_back(i);
last = i+n-1;
if(k >1)last = i+n;
}

}
printf("%d\n",v.size()*k);
for(i=0;i<v.size();i++)
for(int j = 0;j<k;j++)
printf("%d ",v[i]);
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
vector<int> v;
int i;
int last = n;
v.push_back(1);
for(i=1;i<=n+m;i++)
{
if(i==last){
v.push_back(i);
last = i+n-1;
if(k >1)last = i+n;
}

}
printf("%d\n",v.size()*k);
for(i=0;i<v.size();i++){
printf("%d ",v[i]);
for(int j = 1;j<k;j++)
printf("%d ",v[i]+1);
}
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
vector<int> v;
int i;
int last = n;
v.push_back(1);
for(i=1;i<=n+m;i++)
{
if(i==last){
v.push_back(i);
last = i+n-1;
if(k >1)last = i+n;
}

}
printf("%d\n",v.size()*k);
for(i=0;i<v.size();i++){
printf("%d ",v[i]);
for(int j = 1;j<k;j++)
printf("%d ",v[i]);
}
}


#include<bits/stdc++.h>
using namespace std;
int a[1005];
int main()
{
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
vector<int> v;
int i;
for(i=1;i<=k;i++)a[i] = 0;
int j;
for(i=1;i<=n+m;i++)
{
int z = 0;
for(j=1;j<=k;j++)
if(a[j]==0){
v.push_back(i);a[j] = n-1;
}
else {
a[j]--;
if(a[j]==0)z++;
}
if(z==k)
{
v.push_back(i);
a[1] = n-1;
}
}
printf("%d\n",v.size());
for(i=0;i<v.size();i++)
printf("%d ",v[i]);

return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
vector<int> v;
int i;
int last = n;
v.push_back(1);
for(i=1;i<=n+m;i++)
{
if(i==last){
v.push_back(i);
last = i+n-1;
if(k >1)last = i+n;
}

}
printf("%d\n",v.size()*k);
for(i=0;i<k;i++)
printf("1 ");
for(i=1;i<v.size();i++){
printf("%d ",v[i]);
for(int j = 1;j<k;j++)
printf("%d ",v[i]+1);
}
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define read            freopen("C:\\Users\\USER\\Desktop\\in.txt", "r", stdin)
#define write           freopen("C:\\Users\\USER\\Desktop\\in.txt", "a", stdout)
#define pii             pair<int, int>
#define pll             pair<LL, LL>
#define ff              first
#define ss              second
#define inf             1<<30
#define fin(i, a, n)    for (i=(a); i<(n); i++)
#define fid(i, n, a)    for (i=(n)-1; i>=(a); i--)
#define in(a)           scanf("%d", &a)
#define ins(a)          scanf("%s", a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pn              printf("\n");
#define pcs(a)          printf("Case %d: ", a)
#define pr(a)           printf("%d\n", a)
#define pr(a)           printf("%d\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b ,c)    printf("%d %d %d\n", a, b, c)
#define MP              make_pair
#define vi              vector<int>
#define vll             vector<LL>
#define msi             map<string, int>
#define mll             map<LL, LL>
#define _ceil(n, a)     (n)%(a)==0?(n)/(a):(n)/(a)+1;
#define cl              clear()
#define sz              size()
#define pb              push_back
#define MAX(A,B)        (((A)>(B))?(A):(B))
#define MIN(A,B)        (((A)<(B))?(A):(B))
#define all(X)          (X).begin(), (X).end ()
#define iter(it, X)     for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define ext(a)          {printf("%s\n", a); return 0;}
typedef long long LL;
//int  dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int  dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int  dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//bool check(int n, int pos) {return (bool) (n & (1<<pos));}
//int  on(int n, int pos) {return n | (1<<pos);}
//int  off(int n, int pos) {return n & ~(1<<pos);}
//bool operator < (const data &d) const{return cost<d.cost;}

/* ***************************************************************************************
   *************************************************************************************** */
#define M 2010
int main()
{
#ifndef ONLINE_JUDGE
   // read;
#endif
    int n, m, k, i;
    in3(n, m, k);

    if (n==m)
    {
            n==2?pr(2*k+2):pr(2*k+1);

            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            prs(n+m-1);
            if (n==2) prs(4);
            pn;
    }
    else
    {
        if (k==1||n-m==1)
        {
            if (m==1&&n>2)
            {
                pr(2);
                pr2(1, n);
            }
            else
            {
                pr(3);
                prs(1); prs(n);pr(n+m);
            }
        }
        else
        {
            pr(2*k);
            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            pn;
        }
    }
return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define read            freopen("C:\\Users\\USER\\Desktop\\in.txt", "r", stdin)
#define write           freopen("C:\\Users\\USER\\Desktop\\in.txt", "a", stdout)
#define pii             pair<int, int>
#define pll             pair<LL, LL>
#define ff              first
#define ss              second
#define inf             1<<30
#define fin(i, a, n)    for (i=(a); i<(n); i++)
#define fid(i, n, a)    for (i=(n)-1; i>=(a); i--)
#define in(a)           scanf("%d", &a)
#define ins(a)          scanf("%s", a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pn              printf("\n");
#define pcs(a)          printf("Case %d: ", a)
#define pr(a)           printf("%d\n", a)
#define pr(a)           printf("%d\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b ,c)    printf("%d %d %d\n", a, b, c)
#define MP              make_pair
#define vi              vector<int>
#define vll             vector<LL>
#define msi             map<string, int>
#define mll             map<LL, LL>
#define _ceil(n, a)     (n)%(a)==0?(n)/(a):(n)/(a)+1;
#define cl              clear()
#define sz              size()
#define pb              push_back
#define MAX(A,B)        (((A)>(B))?(A):(B))
#define MIN(A,B)        (((A)<(B))?(A):(B))
#define all(X)          (X).begin(), (X).end ()
#define iter(it, X)     for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define ext(a)          {printf("%s\n", a); return 0;}
typedef long long LL;
//int  dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int  dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int  dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//bool check(int n, int pos) {return (bool) (n & (1<<pos));}
//int  on(int n, int pos) {return n | (1<<pos);}
//int  off(int n, int pos) {return n & ~(1<<pos);}
//bool operator < (const data &d) const{return cost<d.cost;}

/* ***************************************************************************************
   *************************************************************************************** */
#define M 2010
int main()
{
#ifndef ONLINE_JUDGE
   // read;
#endif
    int n, m, k, i;
    in3(n, m, k);

    if (n==m)
    {
        pr(2*k+1);
        for (i=0; i<k; i++) prs(1);
        prs(n);
        for (i=0; i<k-1; i++) prs(n+1);
        pr(n+m-1);
    }
    else
    {
        pr(2*k);
        for (i=0; i<k; i++) prs(1);
        prs(n);
        for (i=0; i<k-1; i++) prs(n+1);
        pn;
    }
return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define read            freopen("C:\\Users\\USER\\Desktop\\in.txt", "r", stdin)
#define write           freopen("C:\\Users\\USER\\Desktop\\in.txt", "a", stdout)
#define pii             pair<int, int>
#define pll             pair<LL, LL>
#define ff              first
#define ss              second
#define inf             1<<30
#define fin(i, a, n)    for (i=(a); i<(n); i++)
#define fid(i, n, a)    for (i=(n)-1; i>=(a); i--)
#define in(a)           scanf("%d", &a)
#define ins(a)          scanf("%s", a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pn              printf("\n");
#define pcs(a)          printf("Case %d: ", a)
#define pr(a)           printf("%d\n", a)
#define pr(a)           printf("%d\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b ,c)    printf("%d %d %d\n", a, b, c)
#define MP              make_pair
#define vi              vector<int>
#define vll             vector<LL>
#define msi             map<string, int>
#define mll             map<LL, LL>
#define _ceil(n, a)     (n)%(a)==0?(n)/(a):(n)/(a)+1;
#define cl              clear()
#define sz              size()
#define pb              push_back
#define MAX(A,B)        (((A)>(B))?(A):(B))
#define MIN(A,B)        (((A)<(B))?(A):(B))
#define all(X)          (X).begin(), (X).end ()
#define iter(it, X)     for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define ext(a)          {printf("%s\n", a); return 0;}
typedef long long LL;
//int  dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int  dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int  dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//bool check(int n, int pos) {return (bool) (n & (1<<pos));}
//int  on(int n, int pos) {return n | (1<<pos);}
//int  off(int n, int pos) {return n & ~(1<<pos);}
//bool operator < (const data &d) const{return cost<d.cost;}

/* ***************************************************************************************
   *************************************************************************************** */
#define M 2010
int main()
{
#ifndef ONLINE_JUDGE
   // read;
#endif
    int n, m, k, i;
    in3(n, m, k);

    if (n==m)
    {
        pr(2*k+1);
        for (i=0; i<k; i++) prs(1);
        prs(n);
        for (i=0; i<k-1; i++) prs(n+1);
        pr(n+m-1);
    }
    else
    {
        if (k==1)
        {
            pr(3);
            prs(1); prs(n);pr(n+m);
        }
        else
        {
            pr(2*k);
            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            pn;
        }
    }
return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define read            freopen("C:\\Users\\USER\\Desktop\\in.txt", "r", stdin)
#define write           freopen("C:\\Users\\USER\\Desktop\\in.txt", "a", stdout)
#define pii             pair<int, int>
#define pll             pair<LL, LL>
#define ff              first
#define ss              second
#define inf             1<<30
#define fin(i, a, n)    for (i=(a); i<(n); i++)
#define fid(i, n, a)    for (i=(n)-1; i>=(a); i--)
#define in(a)           scanf("%d", &a)
#define ins(a)          scanf("%s", a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pn              printf("\n");
#define pcs(a)          printf("Case %d: ", a)
#define pr(a)           printf("%d\n", a)
#define pr(a)           printf("%d\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b ,c)    printf("%d %d %d\n", a, b, c)
#define MP              make_pair
#define vi              vector<int>
#define vll             vector<LL>
#define msi             map<string, int>
#define mll             map<LL, LL>
#define _ceil(n, a)     (n)%(a)==0?(n)/(a):(n)/(a)+1;
#define cl              clear()
#define sz              size()
#define pb              push_back
#define MAX(A,B)        (((A)>(B))?(A):(B))
#define MIN(A,B)        (((A)<(B))?(A):(B))
#define all(X)          (X).begin(), (X).end ()
#define iter(it, X)     for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define ext(a)          {printf("%s\n", a); return 0;}
typedef long long LL;
//int  dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int  dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int  dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//bool check(int n, int pos) {return (bool) (n & (1<<pos));}
//int  on(int n, int pos) {return n | (1<<pos);}
//int  off(int n, int pos) {return n & ~(1<<pos);}
//bool operator < (const data &d) const{return cost<d.cost;}

/* ***************************************************************************************
   *************************************************************************************** */
#define M 2010
int main()
{
#ifndef ONLINE_JUDGE
   // read;
#endif
    int n, m, k, i;
    in3(n, m, k);

    if (n==m)
    {
            n==2&&k==1?pr(2*k+2):pr(2*k+1);

            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            prs(n+m);
            if (n==2&&k==1) prs(4);
            pn;
    }
    else
    {
        if (k==1&&n-m==1)
        {
            if (m==1&&n>2)
            {
                pr(2);
                pr2(1, n);
            }
            else
            {
                pr(3);
                prs(1); prs(n);pr(n+m);
            }
        }
        else
        {
            pr(2*k);
            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            pn;
        }
    }
return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define read            freopen("C:\\Users\\USER\\Desktop\\in.txt", "r", stdin)
#define write           freopen("C:\\Users\\USER\\Desktop\\in.txt", "a", stdout)
#define pii             pair<int, int>
#define pll             pair<LL, LL>
#define ff              first
#define ss              second
#define inf             1<<30
#define fin(i, a, n)    for (i=(a); i<(n); i++)
#define fid(i, n, a)    for (i=(n)-1; i>=(a); i--)
#define in(a)           scanf("%d", &a)
#define ins(a)          scanf("%s", a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pn              printf("\n");
#define pcs(a)          printf("Case %d: ", a)
#define pr(a)           printf("%d\n", a)
#define pr(a)           printf("%d\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b ,c)    printf("%d %d %d\n", a, b, c)
#define MP              make_pair
#define vi              vector<int>
#define vll             vector<LL>
#define msi             map<string, int>
#define mll             map<LL, LL>
#define _ceil(n, a)     (n)%(a)==0?(n)/(a):(n)/(a)+1;
#define cl              clear()
#define sz              size()
#define pb              push_back
#define MAX(A,B)        (((A)>(B))?(A):(B))
#define MIN(A,B)        (((A)<(B))?(A):(B))
#define all(X)          (X).begin(), (X).end ()
#define iter(it, X)     for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define ext(a)          {printf("%s\n", a); return 0;}
typedef long long LL;
//int  dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int  dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int  dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//bool check(int n, int pos) {return (bool) (n & (1<<pos));}
//int  on(int n, int pos) {return n | (1<<pos);}
//int  off(int n, int pos) {return n & ~(1<<pos);}
//bool operator < (const data &d) const{return cost<d.cost;}

/* ***************************************************************************************
   *************************************************************************************** */
#define M 2010
int main()
{
#ifndef ONLINE_JUDGE
   // read;
#endif
    int n, m, k, i;
    in3(n, m, k);

    if (n==m)
    {
            n==2?pr(2*k+2):pr(2*k+1);

            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            prs(n+m-1);
            if (n==2) prs(4);
            pn;
    }
    else
    {
        if (k==1)
        {
            if (m==1&&n>2)
            {
                pr(2);
                pr2(1, n);
            }
            else
            {
                pr(3);
                prs(1); prs(n);pr(n+m);
            }
        }
        else
        {
            pr(2*k);
            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            pn;
        }
    }
return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define read            freopen("C:\\Users\\USER\\Desktop\\in.txt", "r", stdin)
#define write           freopen("C:\\Users\\USER\\Desktop\\in.txt", "a", stdout)
#define pii             pair<int, int>
#define pll             pair<LL, LL>
#define ff              first
#define ss              second
#define inf             1<<30
#define fin(i, a, n)    for (i=(a); i<(n); i++)
#define fid(i, n, a)    for (i=(n)-1; i>=(a); i--)
#define in(a)           scanf("%d", &a)
#define ins(a)          scanf("%s", a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pn              printf("\n");
#define pcs(a)          printf("Case %d: ", a)
#define pr(a)           printf("%d\n", a)
#define pr(a)           printf("%d\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b ,c)    printf("%d %d %d\n", a, b, c)
#define MP              make_pair
#define vi              vector<int>
#define vll             vector<LL>
#define msi             map<string, int>
#define mll             map<LL, LL>
#define _ceil(n, a)     (n)%(a)==0?(n)/(a):(n)/(a)+1;
#define cl              clear()
#define sz              size()
#define pb              push_back
#define MAX(A,B)        (((A)>(B))?(A):(B))
#define MIN(A,B)        (((A)<(B))?(A):(B))
#define all(X)          (X).begin(), (X).end ()
#define iter(it, X)     for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define ext(a)          {printf("%s\n", a); return 0;}
typedef long long LL;
//int  dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int  dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int  dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//bool check(int n, int pos) {return (bool) (n & (1<<pos));}
//int  on(int n, int pos) {return n | (1<<pos);}
//int  off(int n, int pos) {return n & ~(1<<pos);}
//bool operator < (const data &d) const{return cost<d.cost;}

/* ***************************************************************************************
   *************************************************************************************** */
#define M 2010
int main()
{
#ifndef ONLINE_JUDGE
   // read;
#endif
    int n, m, k, i;
    in3(n, m, k);

    if (n==m)
    {
        pr(2*k+1);
        for (i=0; i<k; i++) prs(1);
        prs(n);
        for (i=0; i<k-1; i++) prs(n+1);
        pr(n+m-1);
    }
    else
    {
        if (k==1)
        {
            if (m==1&&n>2)
            {
                pr(2);
                pr2(1, n);
            }
            else
            {
                pr(3);
                prs(1); prs(n);pr(n+m);
            }
        }
        else
        {
            pr(2*k);
            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            pn;
        }
    }
return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define read            freopen("C:\\Users\\USER\\Desktop\\in.txt", "r", stdin)
#define write           freopen("C:\\Users\\USER\\Desktop\\in.txt", "a", stdout)
#define pii             pair<int, int>
#define pll             pair<LL, LL>
#define ff              first
#define ss              second
#define inf             1<<30
#define fin(i, a, n)    for (i=(a); i<(n); i++)
#define fid(i, n, a)    for (i=(n)-1; i>=(a); i--)
#define in(a)           scanf("%d", &a)
#define ins(a)          scanf("%s", a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pn              printf("\n");
#define pcs(a)          printf("Case %d: ", a)
#define pr(a)           printf("%d\n", a)
#define pr(a)           printf("%d\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b ,c)    printf("%d %d %d\n", a, b, c)
#define MP              make_pair
#define vi              vector<int>
#define vll             vector<LL>
#define msi             map<string, int>
#define mll             map<LL, LL>
#define _ceil(n, a)     (n)%(a)==0?(n)/(a):(n)/(a)+1;
#define cl              clear()
#define sz              size()
#define pb              push_back
#define MAX(A,B)        (((A)>(B))?(A):(B))
#define MIN(A,B)        (((A)<(B))?(A):(B))
#define all(X)          (X).begin(), (X).end ()
#define iter(it, X)     for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define ext(a)          {printf("%s\n", a); return 0;}
typedef long long LL;
//int  dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int  dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int  dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//bool check(int n, int pos) {return (bool) (n & (1<<pos));}
//int  on(int n, int pos) {return n | (1<<pos);}
//int  off(int n, int pos) {return n & ~(1<<pos);}
//bool operator < (const data &d) const{return cost<d.cost;}

/* ***************************************************************************************
   *************************************************************************************** */
#define M 2010
vi p;
void _insert(int pos, int cnt)
{
    while (cnt--) p.pb(pos);
}
int main()
{
#ifndef ONLINE_JUDGE
   // read;
#endif
    int n, m, k, i, j, cnt=0, A[5000], needed, future;
    in3(n, m, k);

    for (i=0; i<5000; i++) A[i]=0;

    for (i=1; i<=m+n; i++)
    {
        A[i]+=A[i-1];

        if (A[i]<k)
        {
            needed=k-A[i];
            A[i]+=needed;
            A[i+n]-=needed;

            _insert(i, needed);
        }

        future=A[i+1]+A[i];
        if (future==0)
        {
            A[i]++;
            A[i+n]--;

            _insert(i, 1);
        }
    }

pr(p.sz);
for (i=0; i<p.sz; i++) prs(p[i]);
pn;

return 0;
}


#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ctime>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define read            freopen("C:\\Users\\USER\\Desktop\\in.txt", "r", stdin)
#define write           freopen("C:\\Users\\USER\\Desktop\\in.txt", "a", stdout)
#define pii             pair<int, int>
#define pll             pair<LL, LL>
#define ff              first
#define ss              second
#define inf             1<<30
#define fin(i, a, n)    for (i=(a); i<(n); i++)
#define fid(i, n, a)    for (i=(n)-1; i>=(a); i--)
#define in(a)           scanf("%d", &a)
#define ins(a)          scanf("%s", a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pn              printf("\n");
#define pcs(a)          printf("Case %d: ", a)
#define pr(a)           printf("%d\n", a)
#define pr(a)           printf("%d\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b ,c)    printf("%d %d %d\n", a, b, c)
#define MP              make_pair
#define vi              vector<int>
#define vll             vector<LL>
#define msi             map<string, int>
#define mll             map<LL, LL>
#define _ceil(n, a)     (n)%(a)==0?(n)/(a):(n)/(a)+1;
#define cl              clear()
#define sz              size()
#define pb              push_back
#define MAX(A,B)        (((A)>(B))?(A):(B))
#define MIN(A,B)        (((A)<(B))?(A):(B))
#define all(X)          (X).begin(), (X).end ()
#define iter(it, X)     for (__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#define ext(a)          {printf("%s\n", a); return 0;}
typedef long long LL;
//int  dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int  dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int  dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//bool check(int n, int pos) {return (bool) (n & (1<<pos));}
//int  on(int n, int pos) {return n | (1<<pos);}
//int  off(int n, int pos) {return n & ~(1<<pos);}
//bool operator < (const data &d) const{return cost<d.cost;}

/* ***************************************************************************************
   *************************************************************************************** */
#define M 2010
int main()
{
#ifndef ONLINE_JUDGE
   // read;
#endif
    int n, m, k, i;
    in3(n, m, k);

    if (n==m)
    {
            n==2?pr(2*k+2):pr(2*k+1);

            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            prs(n+m-1);
            if (n==2) prs(4);
            pn;
    }
    else
    {
        if (k==1&&n-m==1)
        {
            if (m==1&&n>2)
            {
                pr(2);
                pr2(1, n);
            }
            else
            {
                pr(3);
                prs(1); prs(n);pr(n+m);
            }
        }
        else
        {
            pr(2*k);
            for (i=0; i<k; i++) prs(1);
            prs(n);
            for (i=0; i<k-1; i++) prs(n+1);
            pn;
        }
    }
return 0;
}