import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

interface Func<A,B> {
	B apply(A a);
}

class Add implements Func<???> {
	// TODO
}

public class Fold {
	public static ??? fold(??? f, ??? acc, ??? lst) {
		if (lst.isEmpty()) {
			???
		} else {
			???			
		}
	}
	
	public static void main(String[] args) {
		Integer[] nums = {1,2,3,4,5};
		List<Integer> nums_lst = Arrays.asList(nums);
		LinkedList<Integer> lst = new LinkedList<Integer>(nums_lst);
		int result = Fold.fold(new Add(), 0, lst);
		System.out.println(result);  // should be 15
		System.out.println(lst);  // should be [1,2,3,4,5]
	}
}