#include <bits/stdc++.h>
using namespace std;
int n, m, t1, t2, t3, t4;
char a[4444], b[4444];
int pre[2][4444][28], last[28];
int f[4111][4111];
int main() {
  scanf("%d%d%d%d", &t1, &t2, &t3, &t4);
  gets(a);
  gets(a + 1);
  gets(b + 1);
  a[0] = b[0] = 26;
  n = strlen(a);
  m = strlen(b);
  a[n] = b[m] = 27;
  for (int i = (1); i <= (n - 1); ++i) a[i] -= 'a';
  for (int i = (1); i <= (m - 1); ++i) b[i] -= 'a';
  memset(last, 0xFF, sizeof last);
  for (int i = (0); i <= (n); ++i) {
    for (int j = 0; j < (28); ++j) pre[0][i][j] = last[j];
    last[a[i]] = i;
  }
  memset(last, 0xFF, sizeof last);
  for (int i = (0); i <= (m); ++i) {
    for (int j = 0; j < (28); ++j) pre[1][i][j] = last[j];
    last[b[i]] = i;
  }
  memset(f, 0x3F, sizeof f);
  f[0][0] = 0;
  for (int i = (0); i <= (n); ++i)
    for (int j = (0); j <= (m); ++j) {
      int &k = f[i][j];
      if (i) k = min(k, f[i - 1][j] + t2);
      if (j) k = min(k, f[i][j - 1] + t1);
      if (i && j) {
        k = min(k, f[i - 1][j - 1] + t3 * (a[i] != b[j]));
        if (pre[0][i][b[j]] != -1 && pre[1][j][a[i]] != -1) {
          k = min(k, f[pre[0][i][b[j]] - 1][pre[1][j][a[i]] - 1] + t4 +
                         t2 * (i - 1 - pre[0][i][b[j]]) +
                         t1 * (j - 1 - pre[1][j][a[i]]));
        }
      }
    }
  printf("%d\n", f[n][m]);
  return 0;
}
