#include<bits/stdc++.h>
#define FOR(i, n, m) for(int i = n; i < (int)m; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = std::int_fast64_t;
using P = pair<ll, ll>;
constexpr ll inf = 1000000000;
constexpr ll mod = 1000000007;
constexpr long double eps = 1e-15;
template<typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> p) {
	os << to_string(p.first) << " " << to_string(p.second);
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
	REP(i, v.size()) {
		if(i) os << " ";
		os << to_string(v[i]);
	}
	return os;
}

/*
template<typename T>
struct Treap {
	double drand() { // random number in [0, 1]
		static random_device rd;
		static mt19937 mt(rd());
		return (unsigned)mt() / (double)numeric_limits<unsigned>::max();
	}
	T v;
	double p;
	int cnt;
	Treap* lch;
	Treap* rch;
	Treap(T v) : v(v), p(drand()), cnt(1), lch(NULL), rch(NULL) { }
	Treap* update() {
		this->size = size(this->lch) + size(this->rch) + 1;
		return this;
	}
	static int size(Treap* t) {
		if(!t) return 0;
		else return t->cnt;
	}
	static Treap* merge(Treap* l, Treap* r) {
		if(!l || !r) {
			if(!l) return r;
			else return l;
		}
		if(l->p >= r->p) {
			l->rch = merge(l->rch, r);
			return l->update();
		} else {
			r->lch = merge(r->lch, l);
			return r->update();
		}
	}
	static pair<Treap*, Treap*> split(Treap* t, int k) {
		// split [0, k) and [k, n)
		if(k == 0) return {NULL, t};
		if(!(t->l)) {
			auto tmp = split(t->r, k - 1);
			t->r = tmp.first;
			return {t->update(), tmp.second};
		} else if(!(t->r)) {
			auto tmp = split(t->r, k - 1);
			t->r = tmp.first;
			return {t->update(), tmp.second};
		} else {

		}
	}
	Treap* insert() {
	}
	Treap* erase() {
	}
	T operator[](int k) {
	}
};
*/

int k;
string s;
int n;
int mn, mx, c;

string dfs(int i, int rem, vector<vector<string>>& dp) {
	if(i == n) return "";
	if(dp[i][rem] != "") return dp[i][rem];
	string ret = "";
	if(n - (i + mx) >= rem * mn) {
		ret = max(s.substr(i, mx), dfs(i + mx, rem, dp));
	}
	if(rem) {
		if(ret == "") ret = dfs(i + mn, rem - 1, dp);
		else ret = min(ret, dfs(i + mn, rem - 1, dp));
	}
	return dp[i][rem] = ret;
}

void solve1() {
	vector<vector<string>> dp(n, vector<string>(c + 1, ""));
	cout << dfs(0, c, dp) << endl;
}

void solve2() {
	string ans = "";
	REP(d, mx) {
		for(char num = '1'; num <= '9'; num++) {
			string nans = ans + num;
			int pos = 0;
			int cc = n % k;
			while(pos < n) {
				if(cc == 0) break;
				if(n - pos < mn) break;
				bool ok = true;
				REP(i, nans.size()) {
					if(nans[i] > s[pos + i]) break;
					if(nans[i] < s[pos + i]) ok = false;
				}
				if(ok) {
					cc--;
					pos += mx;
				} else {
					pos += mn;
				}
			}
			if(cc == 0) {
				ans = nans;
				break;
			}
		}
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> k >> s;
	k++;
	n = (int)s.size();
	if(n % k == 0) {
		string ans = "";
		REP(i, k) {
			ans = max(ans, s.substr(n / k * i, n / k));
		}
		cout << ans << endl;
		return 0;
	}
	mn = n / k;
	mx = n / k + 1;
	c = k - n % k;
	if(k <= 300) solve1();
	else solve2();
	return 0;
}
// ---------------------------------------


Measured memory_bytes: 1024