Problem: Professor Abacus has just built a new computing engine for making numerical tables. It was designed to calculate the values of a polynomial function in one variable at several points at a time. With the polynomial function f(x) = x2 + 2x + 1, for instance, a possible expected calculation result is 1 (= f(0)), 4 (= f(1)), 9 (= f(2)), 16 (= f(3)), and 25 (= f(4)).

It is a pity, however, the engine seemingly has faulty components and exactly one value among those calculated simultaneously is always wrong. With the same polynomial function as above, it can, for instance, output 1, 4, 12, 16, and 25 instead of 1, 4, 9, 16, and 25.

You are requested to help the professor identify the faulty components. As the first step, you should write a program that scans calculation results of the engine and finds the wrong values.



Input

The input is a sequence of datasets, each representing a calculation result in the following format.

d
v0
v1
...
vd+2


Here, d in the first line is a positive integer that represents the degree of the polynomial, namely, the highest exponent of the variable. For instance, the degree of 4x5 + 3x + 0.5 is five and that of 2.4x + 3.8 is one. d is at most five.

The following d + 3 lines contain the calculation result of f(0), f(1), ... , and f(d + 2) in this order, where f is the polynomial function. Each of the lines contains a decimal fraction between -100.0 and 100.0, exclusive.

You can assume that the wrong value, which is exactly one of f(0), f(1), ... , and f(d+2), has an error greater than 1.0. Since rounding errors are inevitable, the other values may also have errors but they are small and never exceed 10-6.

The end of the input is indicated by a line containing a zero.

Output

For each dataset, output i in a line when vi is wrong.

Example

Input

2
1.0
4.0
12.0
16.0
25.0
1
-30.5893962764
5.76397083962
39.3853798058
74.3727663177
4
42.4715310246
79.5420238202
28.0282396675
-30.3627807522
-49.8363481393
-25.5101480106
7.58575761381
5
-21.9161699038
-48.469304271
-24.3188578417
-2.35085940324
-9.70239202086
-47.2709510623
-93.5066246072
-82.5073836498
0


Output

2
1
1
6

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/
int n;
vector<ld> v;
ld EPS = 1e-12;


typedef ld Data;
typedef vector<Data> Array;
typedef vector<Array> Matrix;

bool is_zero(Data dat) { return (abs(dat) < EPS); }

Matrix operator-(Matrix mat) {
	REP(i, mat.size()) REP(j, mat[0].size()) mat[i][j] = -mat[i][j];
	return mat;
}

Matrix operator+(Matrix lhs, const Matrix &rhs) {
	REP(i, lhs.size()) REP(j, lhs[0].size()) lhs[i][j] = lhs[i][j] + rhs[i][j];
	return lhs;
}

Matrix operator-(Matrix lhs, const Matrix &rhs) {
	REP(i, lhs.size()) REP(j, lhs[0].size()) lhs[i][j] = lhs[i][j] - rhs[i][j];
	return lhs;
}

Matrix operator*(const Matrix &lhs, const Matrix &rhs) {
	Matrix res(lhs.size(), Array(rhs[0].size(), 0));
	REP(i, lhs.size()) REP(j, rhs[0].size()) REP(k, rhs.size())
		res[i][j] = fma(lhs[i][k], rhs[k][j], res[i][j]);
	return res;
}

Array operator+(const Array &lhs, const Array &rhs) {
	Array res = lhs;
	REP(i, rhs.size()) res[i] = res[i] + rhs[i];
	return res;
}

Array operator*(const Matrix &lhs, const Array &rhs) {
	Array res(lhs.size());
	REP(i, lhs.size())
		res[i] = inner_product(begin(lhs[i]), end(lhs[i]), begin(rhs), Data(0));
	return res;
}

Array operator*(Data scalar, const Array &rhs) {
	Array res(rhs.size());
	REP(i, rhs.size())
		res[i] = scalar * rhs[i];
	return res;
}

Matrix transpose(const Matrix &A) {
	const int n = A[0].size(), m = A.size();
	Matrix res(n, Array(m, 0));
	REP(i, n)REP(j, m) res[i][j] = A[j][i];
	return res;
}

Data inner_product_ex(const Array& a, const Array& b, const Matrix& m) {
	Array b_prime = m*b;
	return inner_product(begin(a), end(a), begin(b_prime), Data(0));
}

Data norm(const Array &a) {
	return inner_product(begin(a), end(a), begin(a), Data(0));
}

Data norm(const Array &a, const Matrix &M) {
	return inner_product_ex(a, a, M);
}

int rankMat(Matrix A) {
	const int n = A.size(), m = A[0].size();
	int r = 0;
	for (int i = 0; r < n && i < m; ++i) {
		int pivot = r;
		for (int j = r + 1; j < n; ++j)
			if (abs(A[j][i]) > abs(A[pivot][i])) pivot = j;
		swap(A[pivot], A[r]);
		if (is_zero(A[r][i])) continue;
		for (int k = m - 1; k >= i; --k)
			A[r][k] = A[r][k] / A[r][i];
		for (int j = r + 1; j < n; ++j)
			for (int k = m - 1; k >= i; --k)
				A[j][k] = fma(-A[r][k], A[j][i], A[j][k]);
		++r;
	}
	return r;
}

Data det(Matrix A) {
	const int n = A.size();
	Data D = Data(1);
	for (int i = 0; i < n; ++i) {
		int pivot = i;
		for (int j = i + 1; j < n; ++j)
			if (abs(A[j][i]) > abs(A[pivot][i])) pivot = j;
		swap(A[pivot], A[i]);
		D = D * A[i][i] * Data(i != pivot ? -1 : 1);
		if (is_zero(A[i][i])) break;
		for (int j = i + 1; j < n; ++j)
			for (int k = n - 1; k >= i; --k)
				A[j][k] = A[j][k] - A[i][k] * A[j][i] / A[i][i];
	}
	return D;
}

bool gauss_jordan(const Matrix& A, const Array& b, const Array& c, const Data& d)
{
	int n = A.size();
	Matrix B(n, Array(n + 1));
	REP(i, n)REP(j, n) B[i][j] = A[i][j];
	REP(i, n) B[i][n] = b[i];
	REP(i, n)
	{
		int pivot = i;
		FOR(j, i, n)
		{
			if (abs(B[j][i]) > abs(B[pivot][i])) pivot = j;
		}
		swap(B[i], B[pivot]);

		if (abs(B[i][i]) < EPS) return false;
		FOR(j, i + 1, n + 1) B[i][j] /= B[i][i];
		REP(j, n)
		{
			if (i != j)
			{
				FOR(k, i + 1, n + 1) B[j][k] -= B[j][i] * B[i][k];
			}
		}
	}
	Array x(n);
	REP(i, n) x[i] = B[i][n];
	ld sum = 0;
	REP(i, n) sum += c[i] * x[i];
	return (abs(sum - d) < EPS);
}



int main()
{
	while (cin >> n, n)
	{
		EPS = 1e-12;
		v.resize(n+3);
		REP(i, n+3) cin >> v[i];
		bool f = true;
		while (f)
		{
			REP(i, n + 3)
			{
				vi a; vector<ld> b;
				int c; ld d;
				REP(j, n + 3)
				{
					if (i == j) continue;
					if (a.size() == n + 1)
					{
						c = j;
						d = v[j];
					}
					else
					{
						a.push_back(j);
						b.push_back(v[j]);
					}
				}
				Matrix A((n + 1), Array(n + 1)); Array  B(n + 1);
				REP(j, n + 1)REP(k, n + 1)
				{
					A[j][k] = pow(a[j], k);
				}
				Array C(n + 1); Data D = d;
				REP(j, n + 1) C[j] = pow(c, j);
				REP(j, n + 1) B[j] = b[j];
				if (gauss_jordan(A, B, C, D))
				{
					f = false;
					cout << i << endl;
				}
			}
			EPS *= 10;
		}

	}
	return 0;
}