title: how to calculate 2^n modulo 1000000007 , n = 10^9
body: <p>what is the fastest method to calculate this, i saw some people using matrices and when i searched on the internet, they talked about eigen values and eigen vectors (no idea about this stuff)...there was a question which reduced to a recursive equation 
  f(n) = (2*f(n-1)) + 2 , and f(1) = 1,
  n could be upto 10^9....
  i already tried using DP, storing upto 1000000 values and using the common fast exponentiation method, it all timed out
  im generally weak in these modulo questions, which require computing large values</p>