#include <string>
#include <map>
#include <vector>
#include <sstream>
#include <cmath>
using namespace std;
int main() {
string str;
stringstream is;
unsigned indecip,dectemp;
unsigned outdecip = 0;
while (cin >> str) {
string temp;
int i = 0, t = 0;
while (i < str.size()) {
size_t pos = str.find('.',i);
if (pos == string::npos) pos = str.size();
temp = str.substr(i, pos - i);
outdecip += stoul(temp)<< (24 - 8 * t);
i = pos + 1;
t++;
}
cout << outdecip<<endl;
cin>>indecip;
string outstr;
for(int j = 0;j<4;j++){
dectemp = indecip>>(24-8*j);
outstr+=to_string(dectemp)+'.';
indecip = indecip-(dectemp<<(24-8*j));
}
outstr.erase(outstr.size()-1);
cout<<outstr;
}
}