#include <iostream>
#include <vector>
using namespace std;
double LP(double x, vector<double> xv, vector<double> yv) { //Lagrange polynomial
int size = xv.size(); //Количество точек (для удобства)
double sum = 0; //Значение функции
for(int i = 0; i < size; i++){
double mul = 1; //Произведение
for(int j = 0; j < size; j++){
if(i!=j) mul *= (x - xv[j])/(xv[i]-xv[j]);
}
sum += yv[i]*mul;
}
return sum;
}
int main() {
int counter = 0;
double a = -3; //Левая грань
double b = 3; //Правая грань
int fragments = 101; //Разбиение
vector<double> xv {};
vector<double> yv {};
double inp;
while(cin >> inp) counter++%2 ? yv.push_back(inp) : xv.push_back(inp); //Заполнение
for(int i = 0; i < fragments; i++){
double x = a + (b-a)/(fragments-1)*i;
printf("%6.3lf\t%6.3lf\n", x, LP(x, xv, yv));
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKZG91YmxlIExQKGRvdWJsZSB4LCB2ZWN0b3I8ZG91YmxlPiB4diwgdmVjdG9yPGRvdWJsZT4geXYpIHsgLy9MYWdyYW5nZSBwb2x5bm9taWFsCglpbnQgc2l6ZSA9IHh2LnNpemUoKTsgLy/QmtC+0LvQuNGH0LXRgdGC0LLQviDRgtC+0YfQtdC6ICjQtNC70Y8g0YPQtNC+0LHRgdGC0LLQsCkKCWRvdWJsZSBzdW0gPSAwOyAvL9CX0L3QsNGH0LXQvdC40LUg0YTRg9C90LrRhtC40LgKCWZvcihpbnQgaSA9IDA7IGkgPCBzaXplOyBpKyspewoJCWRvdWJsZSBtdWwgPSAxOyAvL9Cf0YDQvtC40LfQstC10LTQtdC90LjQtQoJCWZvcihpbnQgaiA9IDA7IGogPCBzaXplOyBqKyspewoJCQlpZihpIT1qKSBtdWwgKj0gKHggLSB4dltqXSkvKHh2W2ldLXh2W2pdKTsKCQl9CgkJc3VtICs9IHl2W2ldKm11bDsKCX0KCXJldHVybiBzdW07Cn0KCmludCBtYWluKCkgewoJaW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