#include <iostream>

using namespace std;

double factorial(double x){
    if (x == 1){
        return 1;
    }
    else {
        return x * factorial(x - 1);
    }
}

int main(){
    int n, i;
    double s = 0;

    cout << "Input N: ";
    cin >> n;

    if (n < 1){
        cout << "N must be positive." << endl;
        return 0;
    }

    i = 1;
    while (i <= n){
        s = s + (1.0 / factorial(i));
        i++;
    }

    cout << "Function result: " << s << endl;    

    return 0;
}