atcoder#ASAPOROF. 数字列をカンマで分ける問題

数字列をカンマで分ける問題

Score : 10001000 points

Problem Statement

You are given a string SS consisting of digits between 1 and 9, inclusive. You will insert at most KK 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

  • 0K<S100,0000 \leq K < |S| \leq 100,000
  • SS consists of digits between 1 and 9, inclusive.

Partial Scores

  • In the test set worth 100100 points, S2|S| \leq 2.
  • In the test set worth another 100100 points, S16|S| \leq 16.
  • In the test set worth another 200200 points, S100|S| \leq 100.
  • In the test set worth another 200200 points, S2,000|S| \leq 2,000.

Input

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

KK

SS

Output

Print the minimum possible value.

2
15267315
315

When the string is separated into 152152, 6767 and 315315, the maximum among these is 315315, which is the minimum possible value.

0
12456174517653111
12456174517653111

1245617451765311112456174517653111 itself is the answer.

8
127356176351764127645176543176531763517635176531278461856198765816581726586715987216581
5317635176