Functions
Function-24
Function-25
Function-26
~/algor $ cat problems/funksiya-faktoriallar-yigindisi
Sum of two factorials
Easy
1000 ms
128 MB
27%
Write a function FactorialSum(a, b) that returns the sum $a! + b!$ for non-negative integers $a$ and $b$.
$$n! = 1 * 2 * \ldots * n, \qquad 0! = 1$$
Example 1: FactorialSum(3, 4) → 30 — $6 + 24 = 30$.
Example 2: FactorialSum(0, 5) → 121
Write only the function body.
Input
One line with two non-negative integers $a$ and $b$ — the arguments of the function.
Output
The value returned by the function: an integer.
Note
$0 \le a, b \le 17$
Examples
Input #1
3 4
Output #1
30
Input #2
0 5
Output #2
121