#include <fstream>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <deque>
using namespace std;
const char infile[] = "pavare2.in";
const char outfile[] = "pavare2.out";
ifstream fin(infile);
ofstream fout(outfile);
const int MAXN = 105;
const int oo = 0x3f3f3f3f;
typedef vector<int> Graph[MAXN];
typedef vector<int> :: iterator It;
const inline int min(const int &a, const int &b) { if( a > b ) return b; return a; }
const inline int max(const int &a, const int &b) { if( a < b ) return b; return a; }
const inline void Get_min(int &a, const int b) { if( a > b ) a = b; }
const inline void Get_max(int &a, const int b) { if( a < b ) a = b; }
int N, A, B;
char s[MAXN];
int Base = 10;
class Huge
{
public: int V[45];
Huge ()
{
memset(V, 0, sizeof(V));
}
Huge (int X)
{
*this = X;
}
Huge operator= (int X)
{
memset(V, 0, sizeof(V));
for(; X; X /= Base)
V[++V[0]] = X % Base;
return *this;
}
Huge operator= (Huge X)
{
memcpy(V, X.V, sizeof(X.V));
return *this;
}
Huge operator+ (Huge X) const
{
int i, T = 0;
Huge Now;
for(i = 1; i <= V[0] || i <= X.V[0] || T; i++, T /= Base)
Now.V[i] = (T += V[i] + X.V[i]) % Base;
Now.V[0] = i - 1;
return Now;
}
int operator== ( Huge X) const
{
int i,n = V[0],m = X.V[0];
if(n < m)
return -1;
if(m > n)
return 1;
for(i = n; i && V[i] == X.V[i]; --i);
if(i==0)
return 0;
if(V[i] < X.V[i])
return -1;
return 1;
}
void Print(ofstream &out) const
{
for(int i = V[0]; i >= 1; i--) fout << V[i];
out << "\n";
}
inline void ToHugeNumber(char *s)
{
V[0] = 0;
for(int i = strlen(s)-1;i >= 0; --i)
V[++V[0]] = s[i]-'0';
}
inline void sub(const Huge B)
{
int i, t = 0;
for (i = 1; i <= V[0]; i++)
{
V[i] -= ((i <= B.V[0]) ? B.V[i] : 0) + t;
V[i] += (t = V[i] < 0) * Base;
}
for (; V[0] > 1 && !V[V[0]]; V[0]--);
}
};
Huge dp[MAXN][MAXN][2], a, Ans;
char S[MAXN];
int main() {
fin >> N >> A >> B >> (S + 1);
a.ToHugeNumber(S + 1);
dp[1][1][0] = dp[1][1][1] = 1;
for(int i = 2 ; i <= N ; ++ i) {
for(int j = 2 ; j <= A ; ++ j) {
dp[i][j][0] = dp[i - 1][j - 1][0];
dp[i][1][1] = dp[i - 1][j - 1][0] + dp[i][1][1];
}
dp[i][1][1] = dp[i][1][1] + dp[i - 1][A][0];
for(int j = 2 ; j <= B ; ++ j) {
dp[i][j][1] = dp[i - 1][j - 1][1];
dp[i][1][0] = dp[i - 1][j - 1][1] + dp[i][1][0];
}
dp[i][1][0] = dp[i][1][0] + dp[i - 1][B][1];
}
for(int i = 1 ; i <= A ; ++ i)
dp[0][0][0] = dp[0][0][0] + dp[N][i][0];
for(int i = 1 ; i <= B ; ++ i)
dp[0][0][0] = dp[0][0][0] + dp[N][i][1];
dp[0][0][0].Print(fout);
int last = -1;
for(int i = N ; i >= 1 ; ) {
if(last != 0) {
for(int j = B ; j ; -- j)
if((dp[i][j][0] == a) < 0)
a.sub(dp[i][j][0]);
else {
for(i -= j ; j ; -- j)
fout << "0";
last = 0;
break;
}
}
if(last != 1) {
for(int j = 1 ; j <= B && (i - j - 1) <= N ; ++ j)
if((dp[i][j][1] == a) < 0)
a.sub(dp[i][j][1]);
else {
for(i -= j ; j ; -- j)
fout << "1";
last = 1;
break;
}
}
}
fout << "\n";
fin.close();
fout.close();
return 0;
}