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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;
const double EPS = 1e-5;

typedef double Number;
typedef vector<Number> Array;
typedef vector<Array> Matrix;

void pMat(Matrix &a){
	REP(i,a.size()){
		REP(j,a[0].size()) cout << a[i][j] << ":";
		cout << endl;
	}
	cout << endl << endl;
}

Matrix mul (Matrix A, Matrix B) {
    int M = A.size(), N = B[0].size();
    assert(A[0].size() == B.size());
    int K = A[0].size();
    Matrix C(M, Array(N, 0));
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < K; k++) {
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }
    return C;
}

struct LUinfo {
  vector<Number> value;
  vector<int> index;
};
LUinfo LU_decomposition(Matrix A) {
  const int N = A.size();
  LUinfo data;
  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]);
    data.index.push_back(pivot);
    for(int j = i+1; j < N; ++j) {
      A[j][i] /= A[i][i];
      for(int k = i+1; k < N; ++k)
        A[j][k] -= A[i][k] * A[j][i];
      data.value.push_back(A[j][i]);
    }
  }
  for(int i = N-1; i >= 0; --i) {
    for(int j = i+1; j < N; ++j)
      data.value.push_back(A[i][j]);
    data.value.push_back(A[i][i]);
  }
  return data;
}
Matrix LU_backsubstitution(const LUinfo &data, Matrix b) {
  const int N = b.size();
  int k = 0;
  for (int i = 0; i < N; ++i){
    swap(b[data.index[i]][0], b[i][0]);
    for(int j = i+1; j < N; ++j)
      b[j][0] -= b[i][0] * data.value[k++];
  }
  for (int i = N-1; i >= 0; --i) {
    for (int j = i+1; j < N; ++j)
      b[i][0] -= b[j][0] * data.value[k++];
    b[i][0] /= data.value[k++];
  }
  return b;
}


int d;

int calc(){
	vector<double> v(d+3);
	int ds = d+1;
	REP(i, d+3) cin >> v[i];
	REP(i, d+3){
		for(int j = i + 1; j < d+3; j++){

			Matrix A(ds, Array(ds, 0));
			Matrix B(ds, Array(1, 0));
			int id = 0;
			REP(k, d+3){
				if(k == i || k == j) continue;
				REP(l, ds) A[id][l] = pow(k, ds-l-1);
				B[id][0] = v[k];
				id++;
			}
			Matrix y = LU_backsubstitution(LU_decomposition(A), B);
			Matrix C(2, Array(ds, 0));
			REP(l, ds) C[0][l] = pow(i, ds-l-1);
			REP(l, ds) C[1][l] = pow(j, ds-l-1);
			
			Matrix z = mul(C, y);
/*
cout << "i : " << i << "j : " << j << endl;
cout << "C : " << endl;
pMat(C);
cout << "z : " << endl;
pMat(z);
*/
			if((abs(z[0][0] - v[i]) < EPS) && (abs(z[1][0] - v[j]) > EPS)) return j;
			if((abs(z[0][0] - v[i]) > EPS) && (abs(z[1][0] - v[j]) < EPS)) return i;
		}
	}
	return -1;
}

int main(void){
	while(cin>>d, d){
		cout << calc() << endl;
	}
	return 0;
}