Modulo 10 ^ 9 + 7 ( 1000000007 ) |  ; f = f * i ; WRONG APPROACH as f may exceed ( 2 ^ 64 - 1 )
static long factorial ( int n ) { const long M = 1000000007 ; long f = 1 ; for ( int i = 1 ; i <= n ; i ++ ) return f % M ; }