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

int main() {
    int x, y;
    cin >> x >> y;
    vector<int> m(206, 0);
    m[0] = 300000;
    m[1] = 200000;
    m[2] = 100000;
    cout << m[x - 1] + m[y - 1] + (x == 1 && y == 1 ? 400000 : 0) << endl;
    return 0;
}
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector<s>
#define vvec(s) vector<vector<s>>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli x;
    lli y;
    cin>>x>>y;
    lli ans=0;
    lli pre=400000-x*100000;
    if(pre>0){ 
        ans+=pre;
    }
    pre=400000-y*100000;
    if(pre>0){ 
        ans+=pre;
    }
    if(y==1&&x==1){ 
        ans+=400000;
    }
    out(ans);


}