#include <bits/stdc++.h>
using namespace std;
const int MAX = 4000 + 10;
const int ALPHA = 30;
const int INF = 1000000000;
int I, D, R, S, n, m;
char a[MAX], b[MAX];
int f[MAX][MAX];
int lasta[MAX][ALPHA], lastb[MAX][ALPHA];
int main() {
  int i, j;
  scanf("%d%d%d%d", &I, &D, &R, &S);
  scanf("%s%s", a + 1, b + 1);
  n = strlen(a + 1), m = strlen(b + 1);
  for (i = 0; i <= n; ++i)
    for (j = 0; j <= m; ++j) f[i][j] = INF;
  for (i = 1; i <= n; ++i) {
    for (j = 0; j < ALPHA; ++j) lasta[i][j] = lasta[i - 1][j];
    lasta[i][a[i] - 'a'] = i;
  }
  for (i = 1; i <= m; ++i) {
    for (j = 0; j < ALPHA; ++j) lastb[i][j] = lastb[i - 1][j];
    lastb[i][b[i] - 'a'] = i;
  }
  f[0][0] = 0;
  for (i = 0; i <= n; ++i)
    for (j = 0; j <= m; ++j) {
      if (i == j && i == 0) continue;
      if (a[i] == b[j]) f[i][j] = f[i - 1][j - 1];
      if (i && j) f[i][j] = min(f[i - 1][j - 1] + R, f[i][j]);
      if (i) f[i][j] = min(f[i - 1][j] + D, f[i][j]);
      if (j) f[i][j] = min(f[i][j - 1] + I, f[i][j]);
      if (j - 1 >= 1 && i - 1 >= 1) {
        int cost = (a[i] == b[j - 1] ? 0 : R) + (a[i - 1] == b[j] ? 0 : R) + S;
        f[i][j] = min(f[i - 2][j - 2] + cost, f[i][j]);
        cost = (a[i] == b[j - 1] ? 0 : R) + S;
        if (lasta[i - 1][b[j] - 'a'] != 0) {
          int p = lasta[i - 1][b[j] - 'a'];
          f[i][j] = min(f[p - 1][j - 2] + cost + (i - 1 - p) * D, f[i][j]);
        }
        cost = (a[i - 1] == b[j] ? 0 : R) + S;
        if (lastb[j - 1][a[i] - 'a'] != 0) {
          int p = lastb[j - 1][a[i] - 'a'];
          f[i][j] = min(f[i - 2][p - 1] + cost + (j - 1 - p) * I, f[i][j]);
        }
        if (lastb[j - 1][a[i] - 'a'] != 0 && lasta[i - 1][b[j] - 'a'] != 0) {
          int p1 = lasta[i - 1][b[j] - 'a'], p2 = lastb[j - 1][a[i] - 'a'];
          f[i][j] =
              min(f[p1 - 1][p2 - 1] + S + (j - 1 - p2) * I + (i - 1 - p1) * D,
                  f[i][j]);
        }
      }
    }
  cout << f[n][m] << endl;
  return 0;
}
