Please implement the test2 function to meet the following four conditions to pass the test, complete it in the most concise way, and guarantee the code quality
module.exports.test2 = (input) = > {
}
(1) test2 () = 0
(2) test2 (1) () = 1
(3) test2 (1) (2) (3) (4) () = 10
(4) const T2 = test2 (1) (2); T2 (3) () = 6; T2 (4) () = 7
) I wrote a function, but I can only meet the first three conditions, ask God for advice, how to meet these four conditions at the same time, I do not know how to write.