#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
void Stringsplit(string str, char split,vector<string>& res)
{
istringstream iss(str);// 输入流
string token;// 接收缓冲区
while (getline(iss, token, split))// 以split为分隔符
{
res.push_back(token);
}
}
int main() {
string ip_str;
cin>>ip_str;
vector<string> str;
Stringsplit(ip_str,'.',str);
string ip;
for(int i=0;i<4;i++){
int t1= atoi(str[i].c_str());
string s1;
while(t1>0){
if(t1%2==1){
s1+="1";
}else s1+="0";
t1/=2;
}
// cout<< s1.length()<<" :"<<endl;
int len=s1.length();
if(len<8){
for(int i=0;i<8-len;i++){
s1+="0";
}
}
reverse(s1.begin(),s1.end());
ip+=s1;
}
double num=0;
for(int i=31;i>=0;i--){
if(ip[i]=='1'){
num+=pow(2,31-i);
}
}
cout<<fixed<<setprecision(0)<< num<<endl;
string res;
long long int ip_int;
cin>>ip_int;
//cout<<ip_int;
string st;
double m=1.0;
while(ip_int>0){
if(ip_int%2==1){
st+='1';
}else st+='0';
ip_int/=2.0;
}
int len2=st.length();
if(len2<32){
for(int i=0;i<32-len2;i++)
st+='0';
}
reverse(st.begin(),st.end());
vector<int> vec;
for(int i=0;i<4;i++){
int temp=0;
string str1=st.substr(8*i,8);
for(int j=7;j>=0;j--){
if(str1[j]=='1')
temp+=pow(2,7-j);
}
vec.push_back(temp);
}
for(int i=0;i<4;i++){
if(i==3)
cout<<vec[i];
else
cout<<vec[i]<<'.';
}
}
// 64 位输出请用 printf("%lld")