#include <bits/stdc++.h>
using namespace std;
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#ifdef ONPC
#define deb(...) cerr << '[' << __FILE__ << ':' << __LINE__ << "] (" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define deb(...)
#endif
// c++ short types
#define vt vector
//typedef long long ll;
typedef long double ld;
void whattime() { cout << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl; }
// const int mod = 1e9 + 7;
const int mod = 998244353;
const int inf = 1e9;
const int64_t infll = 1e13;
bool debug = false;
const ld eps = 1e-9;
const ld pi = acos(-1);
mt19937_64 rng((int) chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 2e5, K = 10;
int subvalue[maxn][K];
struct num {
const int base = 1000'000'000;
vt<int> elems;
num(int x = 0) {
elems = {x};
}
num(int l, int r) {
for(int i = l; i <= r; i += 9) {
elems.push_back(subvalue[i][min(9, r-i+1)]);
}
if(elems.empty()) {
elems = {0};
}
}
void asd() {
while(not elems.size() > 1 and elems.back() == 0) {
elems.pop_back();
}
if(elems.empty()) {
elems.push_back(0);
}
}
void add(num &b) {
int carry = 0;
for(int i = 0; i < max(elems.size(), b.elems.size()) || carry > 0; ++i) {
if(elems.size() == i) {
elems.push_back(0);
}
elems[i] += carry + (i < b.elems.size() ? b.elems[i] : 0);
carry = elems[i] >= base;
if(carry) {
elems[i] -= base;
}
}
}
void print() {
asd();
for(int i = elems.size() - 1; i >= 0; --i) {
cout << elems[i];
}
cout << '\n';
}
};
bool cmp(num &a, num &b) {
a.asd();
b.asd();
if(a.elems.size() != b.elems.size()) {
return a.elems.size() < b.elems.size();
}
for(int i = a.elems.size()-1; i>=0; --i) {
if(a.elems[i] != b.elems[i]){
return a.elems[i] < b.elems[i];
}
}
return false;
}
void solve() {
int n, k;
cin >> n >> k;
string s; cin >> s;
for(int i = 0; i < n; ++i) {
for(int j = 1; j < K; ++j) {
subvalue[i][j] = stoi(s.substr(i, j));
}
}
int z = n / (k+1);
num res(0, s.size()-1);
auto Dfs = [&](auto self, int id, int lastLength, int total, num val = 0) -> void {
if(!cmp(val, res)) {
return ;
}
if(id == k + 1 || total >= n) {
if(id == k + 1 and total == n ){
deb(id, total, val.elems);
swap(res.elems, val.elems);
}
return ;
}
for(auto delta: {-1, 0, +1}) {
int nlength = lastLength + delta;
if(nlength > 0) {
num tmp = {0};
tmp.elems = val.elems;
num addend = {total, total + lastLength - 1};
tmp.add(addend);
self(self, id + 1, nlength, total + nlength, tmp);
}
}
};
for(int i = -4; i <= 4; ++i) i{
int x = z + i;
if(x > 0) {
Dfs(Dfs, 1, x, x, {0, x-1});
}
}
res.print();
}
int main()
{
ios::sync_with_stdio(false); cin.tie(nullptr);
int tt = 1;;
if(debug) {
tt = 1e3;
} else {
cin >> tt;
}
for(int t = 0; t < tt; ++t) {
solve();
}
#ifdef ONPC
whattime();
#endif
return 0;
}