#include<bits/stdc++.h>
#define int long long
using namespace std;
string s;
string ch1;
string ch2;
int num;
bool hav_ch1=false;
bool hav_ch2=false;
bool hav_num=false;
int pow(int di,int mi){
int sum=1;
for(int i=1;i<=mi;i++) sum*=di;
return sum;
}
signed main(){
getline(cin,s);
ch1="";
ch2="";
for(int i=0;i<s.size();i++){
if(!hav_num){
while(s[i]>='0'&&s[i]<='9'){
num=num*10+s[i]-'0';
i++;
}
hav_num=true;
}
if(hav_num&&!hav_ch1&&!hav_ch2){
while(s[i]>='A'&&s[i]<='Z'){
//cout<<1;
ch1=ch1+s[i];
i++;
}
hav_ch1=true;
}
if(hav_num&&hav_ch1&&!hav_ch2){
i+=2;
while(s[i]>='A'&&s[i]<='Z'){
//cout<<2;
ch2=ch2+s[i];
i++;
}
hav_ch2=true;
}
}
//cout<<endl<<num<<" "<<ch1<<" "<<ch2<<endl;
if(ch1[0]=='G'){
if(ch2[0]=='G') cout<<fixed<<setprecision(6)<<num<<endl;
if(ch2[0]=='M') cout<<fixed<<setprecision(6)<<num*pow(2,10)<<endl;
if(ch2[0]=='K') cout<<fixed<<setprecision(6)<<num*pow(2,20)<<endl;
if(ch2[0]=='B') cout<<fixed<<setprecision(6)<<num*pow(2,30)<<endl;
}
if(ch1[0]=='M'){
if(ch2[0]=='G') cout<<fixed<<setprecision(6)<<1.0*num/pow(2,10)<<endl;
if(ch2[0]=='M') cout<<fixed<<setprecision(6)<<num<<endl;
if(ch2[0]=='K') cout<<fixed<<setprecision(6)<<num*pow(2,10)<<endl;
if(ch2[0]=='B') cout<<fixed<<setprecision(6)<<num*pow(2,20)<<endl;
}
if(ch1[0]=='K'){
if(ch2[0]=='G') cout<<fixed<<setprecision(6)<<1.0*num/pow(2,20)<<endl;
if(ch2[0]=='M') cout<<fixed<<setprecision(6)<<1.0*num/pow(2,10)<<endl;
if(ch2[0]=='K') cout<<fixed<<setprecision(6)<<num<<endl;
if(ch2[0]=='B') cout<<fixed<<setprecision(6)<<num*pow(2,10)<<endl;
}
if(ch1[0]=='B'){
if(ch2[0]=='G') cout<<fixed<<setprecision(6)<<1.0*num/pow(2,30)<<endl;
if(ch2[0]=='M') cout<<fixed<<setprecision(6)<<1.0*num/pow(2,20)<<endl;
if(ch2[0]=='K') cout<<fixed<<setprecision(6)<<1.0*num/pow(2,10)<<endl;
if(ch2[0]=='B') cout<<fixed<<setprecision(6)<<num<<endl;
}
/*
switch(ch1){
case 'GB':
switch(ch2){
case 'GB':cout<<fixed<<setprecision(6)<<num<<endl;break;
case 'MB':cout<<fixed<<setprecision(6)<<num*pow(2,10)<<endl;break;
case 'KB':cout<<fixed<<setprecision(6)<<num*pow(2,10)<<endl;break;
case 'B':cout<<fixed<<setprecision(6)<<num*pow(2,10)<<endl;break;
}
}
*/
}