Programming Geek
Rated 4.1/5 based on 446 reviews

CodeVita 2016 Round 2 Question: The Vita Sum

Problem : The Vita Sum


Tom the cat is brushing up his Math skills. He has a bag containing N balls of different colors. Now Tom can randomly pick any even number of balls from the bag. Tom wants to find out the sum of all such combinations of balls that he can pull out from the bag. He can pull out at max K balls in one pick.
Input Format:

First line contains two space separated numbers N and K
Output Format:

The output is the sum of all the combinations of balls he can pull out modulo 10^9+7 i.e. (1000000007)
  1. 0<=N,k<=10^14
  2. N >= k

Sample Input and Output



4 4


We need 4C0 + 4C24C4= 1+6+1=8 


8 3


We need 8C0 + 8C2= 1+28=29