Approximation of e

The Taylor series of the function exe^{x} is ex=i0xii!.e^{x} = \sum_{i \ge 0} \frac{x^{i}}{i!} \enspace .

Note that this series has an infinite number of terms. However, for any xx we can get an approximation of exe^{x} by adding some of the first terms of the series (of course, the more terms, the better the result). In particular, chosing x=1x = 1 gives us a method to compute e271828182845904523536e \simeq 2'71828182845904523536: e=i01i!.e = \sum_{i \ge 0} \frac{1}{i!} \enspace .

Write a program that, for every given natural number nn, prints the approximation of ee that we get by adding the nn first terms of the series above.

Input

Input consists of several natural numbers nn between 0 and 20.

Output

For every given nn, print with 10 digits after the decimal point the approximation of ee that we get by adding the nn first terms of the series above.

Observation

Because of overflow reasons, do all the computations for this exercise using real numbers.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:00:47.619Z

© Jutge.org, 2006–2026.
https://jutge.org