2
aaab
 2
babac
 2
aaaaaabbbb
 1
aabaab
 2
aabbbbccccccdddddddd
 2
abba
 2
aaaazzzz
 250
cececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececece
 3
aaaaaaaaacccdddddd
 2
aabaab
 1
aaaaa
 7
abacaba
 2
aaaabbbb
 5
aaaaa
 1
aaa
 2
aaazz
 3
aabaaaaabb
 2
aaaa
 2
aa
 3
bbbccc
 15
abaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaaabaabbbcababaaa
 1
a
 2
bbaaaa
 2
aaaabb
 2
aabbbb
 2
aaaaaazz
 3
aaaaaaaaacccbbbbbb
 2
bbbbaa
 2
aaaazz
 2
aazzzz
 2
acaccc

-1
 -1
 aaabbaaabb aaaabb
 abbcccddddabbcccdddd abab
 aazzaazz cececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececece
 aaacddaaacddaaacdd aabaab
 aaaaa
 -1
 aabbaabb
 aaaaa
 aaa
 -1
 -1
 aaaa
 aa
 bcbcbc
 aaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbcaaaaaaaabbbbbbc a
 aabaab
 aabaab
 abbabb
 aaazaaaz aaabbcaaabbcaaabbc
 abbabb
 aazaaz azzazz
 accacc

import java.io.*;
import java.math.*;
import java.util.*;
 
public class practice {
	static class Reader{
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public String readLine() throws IOException
        {
            byte[] buf = new byte[10001]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }
 
        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');
 
            if (neg)
                return -ret;
            return ret;
        }
 
        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }
 
        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
 
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
 
            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }
 
            if (neg)
                return -ret;
            return ret;
        }
 
        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }
 
        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
 
        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
	public static void debug(int[][] arr) {
		int r = arr.length;
		int c = arr[0].length;
		int i,j;
		for(i=0;i<r;++i) {
			for(j=0;j<c;++j)  System.err.print(arr[i][j]+" ");
			System.err.println();
		}
	}
	public static void debug(long[][] arr) {
		int r = arr.length;
		int c = arr[0].length;
		int i,j;
		for(i=0;i<r;++i) {
			for(j=0;j<c;++j)  System.err.print(arr[i][j]+" ");
			System.err.println();
		}
	}
	public static void debug(int ...var) {
		for(int i:var)  System.err.print(i+" ");
		System.err.println();
	}
	public static void debug(String ...var) {
		for(String i:var)  System.err.print(i+" ");
		System.err.println();
	}
	public static void debug(double ...var) {
		for(double i:var)  System.err.print(i+" ");
		System.err.println();
	}
	
	public static void debug(long ...var) {
		for(long i:var)  System.err.print(i+" ");
		System.err.println();
	}

    private static Reader scan = new Reader();
    public static void main(String args[]) throws Exception{
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringBuilder sb = new StringBuilder();
        //be careful of readLine() length of string;
        //Scanner scan = new Scanner(System.in);
        //scan.useDelimiter("");  // for reading character by character
        //BufferedReader
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String name = br.readLine();

        int k = scan.nextInt();
        
        String s = scan.readLine();
        int n = s.length();
        int[] alphabets = new int[26];
        for(int i=0;i<26;++i) {
            alphabets[i]=0;
        }
        
        int maxCount=Integer.MIN_VALUE;
        int minCount=Integer.MAX_VALUE;
        for(int i=0;i<n;++i) {
            char c = s.charAt(i);
            ++alphabets[c-'a'];
        }
        for(int i=0;i<26;++i) {
            maxCount=Math.max(maxCount,alphabets[i]);
            minCount=Math.min(minCount,alphabets[i]==0?10000:alphabets[i]);
        }

        if(maxCount==minCount) {
            int length=0;
            for(int i=0;i<26;++i) {
                if(alphabets[i]!=0) {
                    ++length;
                }
            }
            if(n%k!=0) {
                out.print(-1);
            } else {
                n/=k;
                if(n%length!=0) {
                    out.print(-1);
                } else {
                    n/=length;
                }
            }
            for(int i=0;i<26;++i) {
                if(alphabets[i]!=0) {
                    for(int j=0;j<n;++j) {
                        sb.append((char)(i+'a'));
                    }
                }
            }
            while(k-->0) {
                out.print(sb);
            }
        } else {
            out.print(-1);
        }
        out.println("");
        out.close();
        scan.close();

    }
}