#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
long long n, x;
long long a[N];
int main() {
  cin >> n >> x;
  long long res = x + (n - x);
  a[1] = a[2] = 1;
  for (int i = 3; n - i > 0; ++i) {
    a[i] = a[i - 1] + a[i - 2];
    res += (n - i) * 1ll * a[i];
  }
  cout << res << endl;
  return 0;
}
