#include <stdio.h>#include <string.h>#include <map>#include <algorithm>using namespace std ;typedef long long LL ;#define clr( a , x ) memset ( a , x , sizeof a )const int MAXN = 20000005 ;const int mod = 1e9 + 9 ;const int v2 = 5e8 + 5 ;map < LL , int > mp ;map < LL , int > :: iterator it ;bool vis[MAXN] ;int dp[MAXN] ;LL n ;int dfs ( LL n , LL ans = 0 ) { for ( LL i = 1 , j ; i <= n ; i = j + 1 ) { j = min ( n , n / ( n / i ) ) ; LL ni = n / i , x = i + j , y = j - i + 1 ; if ( ni >= mod ) ni %= mod ; if ( x >= mod ) x %= mod ; if ( y >= mod ) y %= mod ; ans += ni * x % mod * y % mod * v2 % mod ; } for ( LL i = 2 ; i * i <= n ; ++ i ) { LL x = n / ( i * i ) ; if ( x < MAXN ) { if ( !vis[x] ) { vis[x] = true ; dp[x] = dfs ( x ) ; } ans -= dp[x] * i % mod ; } else { it = mp.find ( x ) ; if ( it != mp.end () ) ans -= it->second * i % mod ; else { int tmp = dfs ( x ) ; mp.insert ( map < LL , int > :: value_type ( x , tmp ) ) ; ans -= tmp * i % mod ; } } } return ( ans % mod + mod ) % mod ;}int main () { while ( ~scanf ( "%lld" , &n ) ) printf ( "%dn" , dfs ( n ) ) ; return 0 ;}