S001-AC.cc 451 Bytes
#include <iostream>
#include <cmath>
#include <iomanip>
#include <sstream>

using namespace std;

int main()
{
	double x,ncoef=0,coef,result=0,deg=0;
	string str;
	stringstream sstream;

	cin >> x;

	while(1)
	{
		cin >> str;
		if(cin.eof())
		{
			break;
		}
		sstream << str << " ";
		ncoef++;
	}
	for(int i = ncoef; i > 0; i--)
	{
		sstream >> coef;
		result += coef*pow(x,i-1);
	}
	cout << setprecision(4) << fixed << result << endl;
	return 0;
}