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

//#include <atcoder/modint>
//#include <atcoder/dsu>

#define inc(i, n) for (int i = 0; i < (n); ++i)
#define incs(i, st, nd) for (int i = (st); i < (nd); ++i)

#define yes printf("Yes\n")
#define no printf("No\n")

//using pii = pair<int, int>;
using ll = long long;
//using mint = atcoder::modint998244353;
//using mint = atcoder::modint1000000007;

template <class T>
void chmax(T& a, const T& b) {
    a = max(a, b);
}

template <class T>
void chmin(T& a, const T& b) {
    a = min(a, b);
}


constexpr int MAXN = 1e3+5;
int a[MAXN], b[MAXN];
int dp[MAXN][MAXN];

int main(int argc, char const *argv[])
{
    int N, M;
    scanf("%d%d", &N, &M);

    a[0] = b[0] = 0;
    inc(i, N) scanf("%d", &a[i+1]);
    inc(i, M) scanf("%d", &b[i+1]);

    // init
    memset(dp, 0, sizeof dp);
    inc(i, N+1) dp[i][0] = i;
    inc(i, M+1) dp[0][i] = i;

    incs(i, 1, N+1) {
        incs(j, 1, M+1) {
            if (a[i] == b[j]) {
                dp[i][j] = dp[i-1][j-1];
            } else {
                dp[i][j] = 1 + min({dp[i-1][j-1], dp[i-1][j], dp[i][j-1]});
            }
        }
    }

    printf("%d\n", dp[N][M]);
    

    return 0;
}

#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#define inf 0x7fffffff
//#define ll long long
#define int long long
//#define double long double
#define re register int
#define void inline void
#define eps 1e-8
//#define mod 1e9+7
#define ls(p) p<<1
#define rs(p) p<<1|1
#define pi acos(-1.0)
#define pb push_back
#define P pair < int , int > 
#define mk make_pair
using namespace std;
const int mod=1e9+7;
const int M=1e8+5;
const int N=5e5+5;//?????????? 4e8
int n,k;
void solve()
{
	cin>>n>>k;
	cout<<100*n*k*(n+1)/2+n*k*(k+1)/2;
}
signed main()
{
    int T=1;
//    cin>>T;
    for(int index=1;index<=T;index++)
    {
        solve();
//        puts("");
    }
    return 0;
}
/*
 
4 5
1 2
1 3
1 4
2 3
3 4
 
*/ 