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

int main() {
    int x, y;
    cin >> x >> y;
    int ans = (max(0, (4 - x)) + max(0, (4 - y))) * 100000;
    if (x == 1 && y == 1) ans += 400000;
    cout << ans << endl;
}