#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int x, y;
    cin >> x >> y;

    int f = 300000;
    int s = 200000;
    int t = 100000;

    int ans = 0;

    if (x == 1) ans += f;
    else if (x == 2) ans += s;
    else if (x == 3) ans += t;

    if (y == 1) ans += f;
    else if (y == 2) ans += s;
    else if (y == 3) ans += t;

    if (x == 1 && y == 1) ans += 400000;

    cout << ans << '\n';
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

long long ans, n;
 
int main() {
    string s;
    cin >> n >> s;
    for (int i = 0; i < (1 << n); i++) {
        string lr, lb;
        for (int j = 0; j < n; j++) {
            if (i & (1 << j))
                lr += s[j];
            else
                lb += s[j];
        }
 	//cerr << lr << " " << lb << "\n";
        long long dp[40][20];
        memset(dp, 0, sizeof dp);
        dp[n * 2][0] = 1;
        for (int j = n * 2 - 1; j >= n; j--) {
            for (int k = 0; k <= (int)lr.size(); k++) {
                dp[j][k] += (k > 0) * dp[j + 1][k - 1] * (s[j] == lr[k - 1]);
                dp[j][k] += dp[j + 1][k] * (s[j] == lb[(n * 2 - j) - k - 1]);
            }
        }        
		ans += dp[n][(int)lr.size()];
    }
    cout << ans;
    return 0;
}