Problem:
Score : 1000 points

Problem Statement

You are given a string S consisting of digits between 1 and 9, inclusive.
You will insert at most K commas (,) into this string to separate it into multiple numbers.

Your task is to minimize the maximum number among those produced by inserting commas. Find minimum possible such value.

Constraints

0 ≦ K < |S| ≦ 100,000

S consists of digits between 1 and 9, inclusive.

Partial Scores

In the test set worth 100 points, |S| ≦ 2.

In the test set worth another 100 points, |S| ≦ 16.

In the test set worth another 200 points, |S| ≦ 100.

In the test set worth another 200 points, |S| ≦ 2,000.

Input

The input is given from Standard Input in the following format:

K
S

Output

Print the minimum possible value.

Sample Input 1

2
15267315

Sample Output 1

315

When the string is separated into 152, 67 and 315, the maximum among these is 315, which is the minimum possible value.

Sample Input 2

0
12456174517653111

Sample Output 2

12456174517653111

12456174517653111 itself is the answer.

Sample Input 3

8
127356176351764127645176543176531763517635176531278461856198765816581726586715987216581

Sample Output 3

5317635176

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int k;
  string s;
  cin >> k >> s;
  if (k == 0) cout << s << endl;
  if (k == 1) {
    string s11 = s.substr(0, s.size() / 2);
    string s12 = s.substr(s.size() / 2);
    string s21 = s.substr(0, s.size() / 2 + 1);
    string s22 = s.substr(s.size() / 2 + 1);
    if (s11.size() < s12.size()) s11 = s12;
    else if (s11.size() == s12.size() && s11 < s12) s11 = s12;
    if (s21.size() < s22.size()) s21 = s22;
    else if (s21.size() == s22.size() && s21 < s22) s21 = s22;
    if (s11.size() < s21.size() || (s11.size() == s21.size() && s11 < s21)) cout << s11 << endl;
    else cout << s21 << endl;
  }
}