#include<iostream>
using namespace std;


template<size_t N,typename T> T dot_product(T *a,T *b) {
	T total=0.0;
	for(size_t i=0;i<N;++i)
		total += a[i]*b[i] ;

	return total;
};

main() {
  double x[3]={1.0,1.0, 1.0};
  double y[3]={1.0,0.0,-1.0};

  cout<<dot_product<3>(x,y)<<endl;
  cout<<dot_product<2>(x,y)<<endl;
  cout<<dot_product<1>(x,y)<<endl;
  cout<<dot_product<0>(x,y)<<endl;

}