#include <bits/stdc++.h>
using namespace std;

using ll = long long;

const int N = 26;
const int M = 10;

void add_vars(vector<char> &vars, string &s) {
	for (char c : s) {
		if (find(vars.begin(), vars.end(), c) == vars.end()) {
			vars.emplace_back(c);
		}
	}
}

ll process(string &s, vector<int> &dict) {
	ll res = 0LL;
	for (char c : s) {
		res = res * 10LL + dict[c - '0'];
	}
	return res;
}

bool solve(string &s1, string &s2, string &s3, vector<char> &vars, vector<int> &dict, vector<bool> &used,
		long unsigned int idx) {
	if (idx == vars.size()) {
		return process(s1, dict) + process(s2, dict) == process(s3, dict);
	}
	char c = vars[idx];
	for (int i = 0; i < M; i++) {
		if ((0 == i) && ((c == s1[0]) || (c == s2[0]) || (c == s3[0]))) {
			continue;
		}
		if (!used[i]) {
			used[i] = true;
			dict[c - '0'] = i;
			if (solve(s1, s2, s3, vars, dict, used, idx + 1)) {
				return true;
			}
			used[i] = false;
		}
	}
	return false;
}

int main(void) {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	vector<char> vars;
	add_vars(vars, s1);
	add_vars(vars, s2);
	add_vars(vars, s3);
	if (vars.size() > M) {
		cout << "UNSOLVABLE" << endl;
		return 0;
	}
	vector<int> dict(N);
	vector<bool> used(M, false);
	if (solve(s1, s2, s3, vars, dict, used, 0)) {
		cout << process(s1, dict) << endl;
		cout << process(s2, dict) << endl;
		cout << process(s3, dict) << endl;
	} else {
		cout << "UNSOLVABLE" << endl;
	}
	return 0;
}

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
   #include <atcoder/all>
   using namespace atcoder;
#endif
#define all(v) v.begin(), v.end()
using in = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const in INF=(in)1e18+7;
const int inf=max(int(1e18)+7,int(1e9)+7);
using P=pair<int,int>;
using T=tuple<int,int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};
template <typename Typ>
bool chmin(Typ &a, const Typ& b) {if (a > b) {a = b; return true;} return false;}
template <typename Typ>
bool chmax(Typ &a, const Typ& b) {if (a < b) {a = b; return true;} return false;}
template <typename Typ>
Typ ceil(Typ x, Typ y){return (x+y-1)/y;}
#ifdef  _DEBUG
    #define debug(x) cout<<"debug:"<<x<<endl
    #define vdebug(x) cout<<"debug:";\
                      for(auto asdf:x) cout<<asdf<<" ";\
                      cout<<endl
#else
    #define debug(x) 
    #define vdebug(x) 
#endif

int main(){
ios::sync_with_stdio(false);cin.tie(nullptr);
cout << fixed << setprecision(12);
    int N,D,H;  cin>>N>>D>>H;
    vector<int> d(N),h(N);
        rep(i,N) cin>>d[i]>>h[i];
    double ans=0;
    rep(i,N){
        double tmp=H;
        tmp -= (double)(D)*(double)(H-h[i])/(double)(D-d[i]);
        chmax(ans,tmp);
    }
    cout<<ans<<"\n";
    
}/*
./problem.exe
*/