#include <bits/stdc++.h>
using namespace std;
const int inf = 4010;
const int MOD = 1000000007;
const double pi = acos(-1.0);
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
int fx[] = {0, 0, 1, -1};
int fy[] = {-1, 1, 0, 0};
int dp[inf][inf], ll[2][26];
int ei, ed, er, es;
int sz, sz2;
string s1, s2;
int main() {
  ios_base::sync_with_stdio(0);
  int i = 0, j;
  int n, t, cnt = 0;
  cin >> ei >> ed >> er >> es;
  cin >> s1 >> s2;
  sz = s1.size();
  sz2 = s2.size();
  for (j = 0; j < 26; j++) ll[0][j] = 0;
  for (i = 1; i < sz2 + 1; i++) dp[0][i] = i * ei;
  for (i = 1; i < sz + 1; i++) dp[i][0] = i * ed;
  for (i = 1; i < sz + 1; i++) {
    for (j = 0; j < 26; j++) ll[1][j] = 0;
    for (j = 1; j < sz2 + 1; j++) {
      dp[i][j] = min(dp[i][j - 1] + ei, dp[i - 1][j] + ed);
      dp[i][j] =
          min(dp[i - 1][j - 1] + er * (s1[i - 1] != s2[j - 1]), dp[i][j]);
      int tt = ll[0][s2[j - 1] - 'a'] - 1;
      int tu = ll[1][s1[i - 1] - 'a'] - 1;
      if (tt != -1 && tu != -1) {
        dp[i][j] = min(dp[tt][tu] + ed * (i - tt - 2) + ei * (j - tu - 2) + es,
                       dp[i][j]);
      }
      ll[1][s2[j - 1] - 'a'] = j;
    }
    ll[0][s1[i - 1] - 'a'] = i;
  }
  cout << dp[sz][sz2];
  return 0;
}
