#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
string mn = "", mx = "";
for (int i = 0; i < (int)s.size(); i++)
{
if(s[i] == '*')
{
if(i == 0)
mn += "1";
else
mn += "0";
mx += "9";
}
else
{
mn += s[i];
mx += s[i];
}
}
cout << mn << " " << mx << endl;
return 0;
}