import static java.lang.Math.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
@FunctionalInterface
interface if_x 
{     
public double func(double x);
//conversion method if_x to f_x(abstract class)
  
default public long factorial(int n)
{ long mult=1;
 if(n==0) return 1;
 else
 {
 for(int i=1;i<n;i++) mult*=i;
 return mult;
 } 
}
default public double binomial(int n,int k)
{return (double)factorial(n)/((double)(factorial(k)*factorial(n-k)));}

default double dfunc(double x,int n,double h)
{//
 int plusminus=1;
 double total=0.0;
 for(int i=0;i<=n;i++)
 {total+=plusminus*binomial(n,i)*func(x+((double)(n)/2.0-i));}
 //for(int i=1;i<=n;i++) total/=h;
 return total;
}
default double dfunc(double x)
{return dfunc(x,1,1.0e-3);}
default double dfunc(double x,int n)
{return dfunc(x,n,1.0e-3);}

}

