//#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<math.h>

#define DIV 998244353
#define INF 1e15
using namespace std;
using ll = long long;
using ldb = long double;

vector<string> s(3);
map<char, char> mp;
bool chk() {
	vector<ll> N(3);
	for (int i = 0; i < s[0].size(); i++) {
		if (i == 0 && mp[s[0][i]] == '0')return false;
		N[0] *= 10;
		N[0] += mp[s[0][i]] - '0';
	}

	for (int i = 0; i < s[1].size(); i++) {
		if (i == 0 && mp[s[1][i]] == '0')return false;
		N[1] *= 10;
		N[1] += mp[s[1][i]] - '0';
	}

	for (int i = 0; i < s[2].size(); i++) {
		if (i == 0 && mp[s[2][i]] == '0')return false;
		N[2] *= 10;
		N[2] += mp[s[2][i]] - '0';
	}

	//cout << N[0] << endl;
	//cout << N[1] << endl;
	//cout << N[2] << endl;
	if (N[0] + N[1] == N[2]) {
		cout << N[0] << endl;
		cout << N[1] << endl;
		cout << N[2] << endl;
		return true;
	}
	else return false;
}


int main() {
	cin >> s[0] >> s[1] >> s[2];

	vector<char> c;
	map<char, bool> b;
	for (int i = 0; i < s[0].size(); i++) {
		if (!b[s[0][i]]) {
			c.push_back(s[0][i]);
			b[s[0][i]] = true;
		}
	}

	for (int i = 0; i < s[1].size(); i++) {
		if (!b[s[1][i]]) {
			c.push_back(s[1][i]);
			b[s[1][i]] = true;
		}
	}

	for (int i = 0; i < s[2].size(); i++) {
		if (!b[s[2][i]]) {
			c.push_back(s[2][i]);
			b[s[2][i]] = true;
		}
	}

	int kind = b.size();
	if (kind > 10) {
		cout << "UNSOLVABLE" << endl;
		return 0;
	}

	vector<int> P(10);
	for (int i = 0; i < 10; i++) { P[i] = i; }

	do {
		for (int i = 0; i < kind; i++) {
			mp[c[i]] = P[i] + '0';
		}

		if (chk()) {
			return 0;
		}
	} while (next_permutation(P.begin(), P.end()));

	cout << "UNSOLVABLE" << endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
const double PI = acos(-1.0);
/*const double PI = atan2(0.0,-1.0)*/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i,aa,n) for(int i = aa; i <= (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define ar_init(aa,val) rep(i,aa.size()) aa[i]=val;

using pii = pair<ll,ll>;
using vec2d = vector<vector<ll>>;
ll mo=998244353;

ll gg(ll N,ll n){

if(n==0) return 1;
ll pp,hh;
pp=n/2;
hh=n%2;
int tt=gg(N,n/2);
if(hh==0)return tt%mo*tt%mo;
else {return tt%mo*tt%mo*N%mo;}
}

int main(){
//cout<<fixed<<setprecision(15);


ll nn,mm,kk;
cin>>nn>>mm>>kk;
if(nn==1&&mm==1){
cout<<kk<<endl;
return 0;
}
if(nn==1){
cout<<gg(kk,mm)<<endl;
return 0;
}
if(mm==1){
cout<<gg(kk,nn)<<endl;
return 0;
}

ll sd=0;
vector<ll> df1(kk+1);
df1[0]=0;
rep1(i,1,kk){
sd+=df1[i-1];
df1[i]=gg(i,nn)-gg(i-1,nn);
}

ll ans=0;
rep1(i,1,kk){
ans+=df1[i]*gg(kk-i+1,mm)%mo;
ans%=mo;
}


cout<<(ans+mo)%mo<<endl;


}