洛谷链接:
https://www.luogu.com.cn/problem/P1634?contestId=24234
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int x=in.nextInt();
int n=in.nextInt();
long sum=1+x;
for(int i=1;i<n;i++) {
sum=sum+sum*x;
}
System.out.println(sum);
}
}