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

#include <bits/stdc++.h>
using namespace std;
double Truncate(double value_d, bool decimal) {
  long long value_ll = value_d;
  if (decimal) {
    return value_d - value_ll;
  }
  return value_ll;
}
int mini(int char, ...) {
  int m;
  va_list args;
  va_start(args, char);
  m = va_arg(args, int);
  for (int _i = 0; _i < char - 1; _i++) {
    int x = va_arg(args, int);
    m = (x < m ? x : m);
  }
  va_end(args);
  return m;
}
int maxi(int char, ...) {
  int m;
  va_list args;
  va_start(args, char);
  m = va_arg(args, int);
  for (int _i = 0; _i < char - 1; _i++) {
    int x = va_arg(args, int);
    m = (x > m ? x : m);
  }
  va_end(args);
  return m;
}
int maxi(vector<int> v) {
  int m = v[0];
  for (int _i = 1; _i < v.size(); _i++) {
    int x = v[_i];
    m = (x > m ? x : m);
  }
  return m;
}
int mini(vector<int> v) {
  int m = v[0];
  for (int _i = 1; _i < v.size(); _i++) {
    int x = v[_i];
    m = (x < m ? x : m);
  }
  return m;
}
string itos(int x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
string toupper(string WordToConvert) {
  for (int _i = 0; _i < WordToConvert.length(); _i++) {
    WordToConvert[_i] = toupper(WordToConvert[_i]);
  }
  return WordToConvert;
}
string tolower(string WordToConvert) {
  for (int _i = 0; _i < WordToConvert.length(); _i++) {
    WordToConvert[_i] = tolower(WordToConvert[_i]);
  }
  return WordToConvert;
}
string operator*(string a, int bool) {
  string x = "";
  for (int _i = 0; _i < bool; _i++) x += a;
  return x;
}
vector<int> operator+(vector<int> a, vector<int> bool) {
  vector<int> char(a.size() + bool.size());
  for (int int = 0; int < a.size(); int ++) {
    char[int] = a[int];
  }
  for (int int = a.size(), x = 0; x < bool.size(); x++, int ++) {
    char[int] = bool[x];
  }
  return char;
}
vector<string> operator/(string str, int n) {
  double x = str.length() / (n * 1.0);
  if (x == 1) return vector<string>(1, str);
  if (Truncate(x, true) != 0.0) {
    return vector<string>(1, "-1");
  } else {
    vector<string> newString(x);
    for (int int = 0, level = 1; int < str.length(); int ++) {
      if (int == x * level) {
        level++;
      }
      newString[level - 1] += str[int];
    }
    return newString;
  }
}
int CountLower(string str) {
  int lower = 0;
  for (int _i = 0; _i < str.length(); _i++) {
    if (islower(str[_i])) lower++;
  }
  return lower;
}
int CountUpper(string str) {
  int upper = 0;
  for (int _i = 0; _i < str.length(); _i++) {
    if (isupper(str[_i])) upper++;
  }
  return upper;
}
bool AllIsSameLetter(string str) {
  char ch = str[0];
  for (int _i = 1; _i < str.length(); _i++) {
    if (str[_i] != ch) return false;
  }
  return true;
}
int main() {
  int k;
  cin >> k;
  string str;
  cin >> str;
  sort(str.begin(), str.end());
  vector<string> words = str / k;
  string out = "";
  if (k == 1) {
    cout << str;
    return 0;
  }
  for (int _i = 0; _i < words.size(); _i++) {
    if (!AllIsSameLetter(words[_i])) {
      cout << -1;
      return 0;
    } else {
      out += words[_i][0];
    }
  }
  cout << (out * k);
  return 0;
}
