import java.util.function.Function;
import static fun.SKY.Fun.*;
public class SKY {
public interface Fun<A, B> extends Function<A, B> {
static <A> Fun<A, A> I() {
return a -> a;
}
static <E, A> Fun<E, A> K(final A a) {
return e -> a;
}
static <E, A, B> Fun<E, B> S(
final Fun<E, Fun<A, B>> f,
final Fun<E, A> a) {
return e -> f.apply(e).apply(a.apply(e));
}
static <A,B> Fun<A,B> Y(
final Fun<Fun<A,B>, Fun<A,B>> f) {
return x -> f.apply(Y(f)).apply(x);
}
Fun<Long, Fun<Long, Long>> PLUS =
a -> b -> a + b;
Fun<Long,Long> FACT = Y(f -> n ->
(n <= 1)? 1: (n * f.apply(n - 1)));
}
public static void main(final String[] args) {
final Fun<Long, Long> xx = S(S(K(PLUS), I()), I());
System.out.println(FACT.compose(xx).apply(10L));
}
}