A signal-processing test bench chains together amplifiers labeled with every integer from L to R, inclusive. The amplifier labeled k multiplies the amplitude of the signal passing through it by exactly k, so the bench's total gain G equals the product of every integer from L to R.
Because the bench's numeric display is narrow, G is never shown as a raw decimal integer. Instead the display renders G's compressed form, built as follows:
e, and call the remaining digit string core (core is never empty).d be the number of digits in core.d is at most 10, the compressed form is core followed by the letter e followed by the decimal value of e (no leading zeros).d is greater than 10, the compressed form is the first 5 digits of core, followed by the three characters ..., followed by the last 5 digits of core, followed by the letter e followed by the decimal value of e.Given L and R, print the bench's total gain in compressed form.
A single line containing two integers L and R, separated by a single space.
A single line containing the compressed form of G, exactly as described above, with no surrounding whitespace.
1 <= L <= R <= 2000
Example 1
Input
1 4
Expected
24e0
Explanation
The chain runs 1*2*3*4 = 24. There are no trailing zeros to strip, so e = 0 and the compressed form is '24e0'.
Example 2
Input
2 11
Expected
399168e2
Explanation
The product 2*3*...*11 = 39916800, which ends in two zeros. Stripping them gives core '399168' (6 digits, at most 10) and e = 2, so the compressed form is '399168e2'.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →