//	#pragma comment(linker, "/STACK:60000000")
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <vector>
#include <set>
#include <string>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define len(x) (int((x).size()))
#ifdef LOCALD
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) {}
#endif

#ifdef __linux__
#define I64d "%lld"
#else
#define I64d "%I64d"
#endif

typedef long long int int64;
typedef long double ext;

const int inf = 1000000000;


using namespace std;

const int maxs = 2000000;
const int alpha = 26;
const int steps = 2000000;
int n, q,  k, mx, mn;
char text[maxs], s[maxs];
vector<int> r;
vector<string> x;


void pref(int sum){
	int k = rand() % len(x);
	int l = min(len(x[k]), min(sum, mn + rand() % mx + 1));
	for (int i = 0; i < l; i++)
		s[i] = x[k][i];
	s[l] = 0;		
}
void suf(int sum){
	int k = rand() % len(x);
	int l = min(len(x[k]), min(sum, mn + rand() % mx + 1));
	for (int i = 0; i < l; i++)
		s[i] = x[k][len(x[k]) - l + i];
	s[l] = 0;		
}

void substr(int sum){
	int k = rand() % len(x);
	int l = rand() % len(x[k]);
	int ln = min(len(x[k]), min(sum, mn + rand() % mx + 1));
	for (int i = 0; i < ln; i++)
		s[i] = x[k][l + i];
	s[ln] = 0;		
}

                                                                        

int main(int argc, char *argv[])
{
	n = atoi(argv[1]);
	q = atoi(argv[2]);
	mx = atoi(argv[3]);
	mn = atoi(argv[4]);
	int ss = atoi(argv[5]);
	srand(13 * n + 7 * q + 101 * ss);
	for (int i = 0; i < n; i++)                                                       
		text[i] = 'a' + rand() % alpha;					
	text[n] = 0;
	int qq = (81 * q) / 100;	
	int sum = qq;
	while (sum > 0){
		eprintf("SUM = %d\n", sum);
		int cur = min(sum, rand() % mx + 1 + mn);
		for (int i = 0; i < cur; i++)
			s[i] = 'a' + rand() % alpha;
		s[cur] = 0;            
		x.pb(string(s));
		sum -= len(x.back());
		//eprintf("%s\n", x.back().c_str());
	}

	sum = q - qq;
	while (sum > 0){
		eprintf("SUM = %d\n", sum);
		int c = rand() % 3;
		if (c == 0)
			substr(sum);
		else if (c == 1)
			pref(sum);
		else if (c == 2)
			suf(sum);
		x.pb(string(s));					
		sum -= len(x.back());
		//eprintf("%s\n", x.back().c_str());
	}                           

	for (int i = 0; i < steps; i++){
		int k = rand() % len(x);
		int ln = len(x[k]);
		int l = rand() % (n - ln + 1);
		for (int j = 0; j < ln; j++)
			text[l + j] = x[k][j];
		/*if (rand() % 100 != 0)
			continue;
		int cnt = rand() % 10 + 1;
		for (int j = 0; j < cnt; j++){
			int y = rand() % ln;
			text[l + y] = 'a' + rand() % alpha;
		}			*/
	}

	printf("%s\n", text);
	printf("%d\n", len(x));
	for (int i = 0; i < len(x); i++)
		printf("%s\n", x[i].c_str());
							
		
	
    return 0;
}
