#include <bits/stdc++.h>
using namespace std;
const int maxn = 4100;
const int inf = 500000000;
string a, b;
int opt[maxn][maxn];
int lastA[maxn][26], lastB[maxn][26];
int Ti, Td, Tr, Te, n, m;
int main() {
  cin >> Ti >> Td >> Tr >> Te;
  cin >> a >> b;
  n = a.size(), m = b.size();
  memset(lastA, 0, sizeof(lastA));
  memset(lastB, 0, sizeof(lastB));
  for (int i = 1; i <= n; i++) {
    char cur = a[i - 1];
    for (int j = 0; j < 26; j++) {
      lastA[i][j] = lastA[i - 1][j];
      if (cur - 97 == j) lastA[i][j] = i;
    }
  }
  for (int i = 1; i <= m; i++) {
    char cur = b[i - 1];
    for (int j = 0; j < 26; j++) {
      lastB[i][j] = lastB[i - 1][j];
      if (cur - 97 == j) lastB[i][j] = i;
    }
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) opt[i][j] = inf;
  opt[0][0] = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      if (i + j) {
        if (i && j && a[i - 1] == b[j - 1])
          opt[i][j] = min(opt[i][j], opt[i - 1][j - 1]);
        if (i && j) opt[i][j] = min(opt[i][j], opt[i - 1][j - 1] + Tr);
        if (j) opt[i][j] = min(opt[i][j], opt[i][j - 1] + Ti);
        if (i) opt[i][j] = min(opt[i][j], opt[i - 1][j] + Td);
        if (i && j) {
          int y = lastB[j - 1][a[i - 1] - 97];
          int x = lastA[i - 1][b[j - 1] - 97];
          if (x && y)
            opt[i][j] = min(opt[i][j], opt[x - 1][y - 1] + (i - x - 1) * Td +
                                           (j - y - 1) * Ti + Te);
        }
      }
  cout << opt[n][m] << endl;
  return 0;
}
