var k,i,j:integer; c: char;
s,t,answer: string;
begin
readln(k);
readln(s);
t:='';
for c:='a' to 'z' do begin
j:=0;
for i:=1 to length(s) do begin
if c=s[i] then j:=j+1;
end;
while (j mod k = 0) and( j>0) do begin t:=t+c; j:=j-k end;
if (j mod k <> 0) and( j>0) then begin write(-1);exit end;
end;
answer:='';
while k>0 do begin
answer:=answer+t;
k:=k-1
end;
writeln(answer);
end.
dmFyIGssaSxqOmludGVnZXI7IGM6IGNoYXI7CnMsdCxhbnN3ZXI6IHN0cmluZzsKCmJlZ2luCnJlYWRsbihrKTsKcmVhZGxuKHMpOwoKdDo9Jyc7CmZvciBjOj0nYScgdG8gJ3onIGRvIGJlZ2luCiAgICAKICAgIGo6PTA7CiAgICBmb3IgaTo9MSB0byBsZW5ndGgocykgZG8gYmVnaW4KICAgICAgICBpZiBjPXNbaV0gdGhlbiBqOj1qKzE7CiAgICBlbmQ7CgogICAgd2hpbGUgKGogbW9kIGsgPSAwKSBhbmQoIGo+MCkgZG8gYmVnaW4gIHQ6PXQrYzsgajo9ai1rIGVuZDsKICAgIGlmIChqIG1vZCBrIDw+IDApIGFuZCggaj4wKSB0aGVuIGJlZ2luIHdyaXRlKC0xKTtleGl0IGVuZDsKICAgIAplbmQ7CgphbnN3ZXI6PScnOwp3aGlsZSBrPjAgZG8gYmVnaW4gCiAgICBhbnN3ZXI6PWFuc3dlcit0OyAKICAgIGs6PWstMSAKZW5kOwoKd3JpdGVsbihhbnN3ZXIpOwoKZW5kLg==
MgphYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW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