#include <bits/stdc++.h>
using namespace std;
using ll = int;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using gr = vector<vll>;
using wgr = vector<vpll>;
struct d_ {
  template <typename T>
  d_ &operator,(const T &x) {
    cerr << ' ' << x;
    return *this;
  }
  template <typename T>
  d_ &operator,(const vector<T> &x) {
    for (auto x : x) cerr << ' ' << x;
    return *this;
  }
} d_t;
ll ins, del, repl, exch;
string A, B;
ll an, bn;
ll DP[4007][4007];
ll posa[4007][26];
ll posb[4007][26];
ll dp(ll a, ll b) {
  ll &ret = DP[a][b];
  if (~ret) return ret;
  if (a == an && b == bn) return ret = 0;
  if (a == an) return ret = ins + dp(a, b + 1);
  if (b == bn) return ret = del + dp(a + 1, b);
  ret = (1 << 30);
  if (A[a] == B[b]) ret = min(ret, dp(a + 1, b + 1));
  if (a + 1 < an && b + 1 < bn && A[a] != B[b]) {
    ll pa = posa[a + 1][B[b] - 'a'];
    ll push_back = posb[b + 1][A[a] - 'a'];
    if (~pa && ~push_back) {
      ret = min(ret, exch + del * (pa - (a + 1)) + ins * (push_back - (b + 1)) +
                         dp(pa + 1, push_back + 1));
    }
  }
  ret = min(ret, repl + dp(a + 1, b + 1));
  ret = min(ret, del + dp(a + 1, b));
  ret = min(ret, ins + dp(a, b + 1));
  return ret;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  (memset(DP, -1, sizeof(DP)));
  (memset(posa, -1, sizeof(posa)));
  (memset(posb, -1, sizeof(posb)));
  cin >> ins >> del >> repl >> exch;
  cin.ignore();
  getline(cin, A);
  getline(cin, B);
  an = A.size(), bn = B.size();
  for (ll i = an - 1; i >= 0; i--) {
    for (ll j(0); j < 26; j++) posa[i][j] = posa[i + 1][j];
    posa[i][A[i] - 'a'] = i;
  }
  for (ll i = bn - 1; i >= 0; i--) {
    for (ll j(0); j < 26; j++) posb[i][j] = posb[i + 1][j];
    posb[i][B[i] - 'a'] = i;
  }
  cout << dp(0, 0) << endl;
  return 0;
}
