interface R {
    public double func();
}

class A implements R {
    int k;
    R x1, x2, x3, x4, x5;
    A(int k, R x1, R x2, R x3, R x4, R x5) {
	this.k = k;
	this.x1 = x1;
	this.x2 = x2;
	this.x3 = x3;
	this.x4 = x4;
	this.x5 = x5;
    }

    R b = (new R() {
	    public double func() { 
		k -= 1;
		return new A(k, b, x1, x2, x3, x4).func(); 
	    }
	});

    public double func() {
	if (k <= 0) return x4.func() + x5.func();
	else return b.func();
    }
    
    
}

public class Joy {
    static R x1 = (new R() {public double func() { return 1; }});
    static R x2 = (new R() {public double func() { return -1; }});
    static R x3 = (new R() {public double func() { return -1; }});
    static R x4 = (new R() {public double func() { return 1; }});
    static R x5 = (new R() {public double func() { return 0; }});


    public static void main(String[] args) {
	for (int i = 2; i <= 5; i++) {
	    System.out.println("i = " + (new A(i, x1, x2, x3, x4, x5).func()));
	}
    }
}