#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

typedef long long ll;
//const ll correct = 2122389473;
const ll correct = 1590773764;

ll p = (1LL << 31) -1;
//ll b = (1LL << 19) -1;
ll b = 1e9+7;

int main() {
	string s;
	ll hash = 0;
	cin >> s;
	for(int i = s.size()-1; i >= 0; i--) {
		if(s[i] != '.')
			hash = (hash * b + s[i]-'0') % p;
	}
	ll a = 1;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] != '.') {
			ll tmp = (hash - (s[i]-'0') * a + p) % p;
			for(int j = 0; j < 10; j++) {
				if(correct == (tmp + j * a) % p) {
					cout << s[i] << " " << j << endl;
					return 0;
				}
			}
			a = (a * b) % p;
		}
	}
}