Category

Similar Problems

0732. Function

Time limit : 1000 ms
Memory limit : 64 mb

Calculate the function: 

   




Input

One positive integer n (1 ≤ n ≤ 1012).

   Output                                     

The value of f(n) modulo 1000000009.

 Samples                                 

Input

Output

1

7

10

 

Tayyorladi: Azat Yusupov
Text from: e-olimp.com