UCV2013A

UCV2013A

#include<iostream>
#include<stdio.h>
using namespace std;
#define m 1000000007
int main()
{
long long int n, l, a, b;
while (1)
{
a = 1;
b = 0;
scanf("%lld%lld",&n,&l);
if(n == 0 && l == 0) return 0;
for (int i = 1; i < l + 1; i++)
{
a=(n *a)% m;
b=(b+a) % m;
}
printf("%lld\n",b);
}
return(0);

}

No comments:

Post a Comment