#include <iostream>
#include <cmath>
using namespace std;
int main() {
  double a, n, p, f=1, sum=1;
  cout<<"Enter the value of a: ";
  cin>>a;
  cout<<"Enter the nth term: ";
  cin>>n;
  
  int i=1;
  while(i<=n) {
    p = pow(a, pow(2, i));
    f = f * (pow(2, i));
    i++;
    sum += (p/f);
  }
  cout<<"\nThe sum of the series: "<<sum;
  return 0;
}