#include <iostream>
#include <cmath>
using namespace std;
double x,y;
main()
{
cin >> x;
while (true)
{
cin >> y;
if (y==0) break;
if (y==1) cout << exp(x) << '\n';
if (y==2) cout << log(x) << '\n';
if (y==3) cout << abs(x) << '\n';
if (y==4) cout << pow(10,x) << '\n';
}
}