why have we use predefined MOD variable in this code?
@aslesha.j7, Its not necessary, but then you would have to write 1000000007 everywhere.