#include <bits/stdc++.h>
using namespace std;
long long shizuku(long long);
struct UnionFind {
  vector<long long> par;
  UnionFind(long long N) : par(N) {
    for (long long i = 0; i < N; i++) par[i] = i;
  }
  long long root(long long x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(long long x, long long y) {
    long long rx = root(x);
    long long ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }
  bool same(long long x, long long y) { return root(x) == root(y); }
};
signed main() {
  long long pow, D, G, N, M, X, count = 0, count2 = 0;
  double d;
  long long C = 'A' - 'a';
  char op;
  string S, T;
  cin >> N >> M;
  cout << (N * 3 + M) / 3 << endl;
}
