#include<iostream> #include<string> #include<stdio.h> #include<algorithm> #include<cstring> #include<cstdio> #include <math.h> using namespace std; int a; char b[100]; float s; int main(){ scanf("%d %s",&a,b); //printf("%s ",b); int len = strlen(b); s= 0; for(int i = 2 ; i < len ; i++) { int t = 0; if(b[i] >= 'A') t = b[i] -'A' + 10; else t = b[i] - '0'; s += pow(a,-i+1) * t; } s *= 10000; s = floor(s + 0.5); s /= 10000; printf("%0.4f ",s); //printf("%s ",a); return 0; }