#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, x, y;     cin >> n >> m;     y = 3 * m;     x = 2 * n;     for (int i = 6; i <= x && i <= y; i += 6) {       if (x <= y)         x += 2;       else         y += 3;     }     cout << max(x, y);     return 0;   }   