#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <bits/stdc++.h>
using namespace std ;
#define rep(i, a, b) for (register int i = (a); i <= (b); ++i)
#define per(i, a, b) for (register int i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (register int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter putchar('\n')
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 2e6 + 100 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 1e9 + 7 ;
const double eps = 1e-7 ;

int n, m, k, high_bit;

char s[maxn], t[maxn];

set <pii> interval;

void write()
{
	puts("s : ");
	rep(i, 1, high_bit + k + 1) putchar(s[i]);
	enter;
	puts("t : ");
	rep(i, 1, high_bit + k + 1) putchar(t[i]);
	enter;
	for(auto it : interval) printf("[%d, %d], ", it.fi, it.se);
	enter;
}

iv solve(const int& pos, const int& tim)
{
	// printf("-------------------------------------\nsolve : %d %d\n", pos, tim);
	// write();
	if(!tim) return ;
	if(s[pos] == '0' || t[pos] == '0') return ;
	register pii after = *(interval.ub(mp(pos, pos)));
	if(after.fi != pos + 1) after.se = -1;
	register int tmp = pos;
	s[pos] = '0', t[pos] = '0';
	if(after.se == -1)
	{
		// puts("add");
		++ tmp;
		s[tmp] ++, t[tmp] ++;
		while(s[tmp] == '2' || t[tmp] == '2')
		{
			++ tmp;
			if(s[tmp - 1] == '2') s[tmp] ++, s[tmp - 1] = '0';
			else t[tmp] ++, t[tmp - 1] = '0';
		}
		interval.insert(mp(pos, pos));
		if(interval.lb(mp(pos, pos)) != interval.begin())
		{
			register pii pre_inter = *(--interval.lb(mp(pos, pos)));
			if(pre_inter.se == pos - 1) interval.erase(interval.find(mp(pos, pos))), interval.erase(interval.find(pre_inter)), interval.insert(mp(pre_inter.fi, pos));
		}
		if(tmp > pos + 2) interval.insert(mp(pos + 2, tmp - 1));
		if(s[tmp] == '0' || t[tmp] == '0')
		{
			register pii after_modify = *(interval.ub(mp(tmp, -1)));
			interval.erase(interval.find(after_modify));
			if(after_modify.se > tmp && after_modify.fi == tmp) interval.insert(mp(tmp + 1, after_modify.se));
			return ;
		}
		else solve(tmp, tim - 1);
	}
	else
	{
		// puts("pass");
		interval.erase(interval.find(after));
		register int tmp = pos + min(after.se - after.fi + 1, tim);
		interval.insert(mp(pos, tmp - 1));
		if(tmp < after.se) interval.insert(mp(tmp + 1, after.se));
		s[tmp] ++, t[tmp] ++;
		solve(tmp, tim - min(after.se - after.fi + 1, tim));
	}
}

signed main()
{
	// file("main");
	// puts("--------------------------");
	// puts("init : ");
	scanf("%d %d %d", &n, &m, &k);
	scanf("%s %s", s + 1, t + 1);
	high_bit = max(n, m);
	reverse(s + 1, s + n + 1), reverse(t + 1, t + m + 1);
	rep(i, n + 1, high_bit + k + 1) s[i] = '0';
	rep(i, m + 1, high_bit + k + 1) t[i] = '0';
	int last = 0, flag = 0;
	rep(i, 1, high_bit)
	{
		if(s[i] == '0' && t[i] == '0')
		{
			flag = 1;
			continue;
		}
		if(flag) flag = 0, interval.insert(mp(last + 1, i - 1));
		last = i;
	}
	interval.insert(mp(high_bit + 1, high_bit + k + 1));

	// puts("--------------------------");
	// puts("work : ");
	per(i, high_bit, 1) if(s[i] == '1' && t[i] == '1') solve(i, k);

	// puts("--------------------------");
	// puts("output : ");
	reverse(s + 1, s + high_bit + k + 2), reverse(t + 1, t + high_bit + k + 2);
	int sta = 1;
	while(s[sta] == '0') sta ++;
	rep(i, sta, high_bit + k + 1) putchar(s[i]);
	enter;
	sta = 1;
	while(t[sta] == '0') sta ++;
	rep(i, sta, high_bit + k + 1) putchar(t[i]);
	enter;

	return 0;
}

Measured memory_bytes: 24576