#include <bits/stdc++.h>
using namespace std;
int n, m, ti, tr, te, td;
char a[4100], b[4100];
int f[4100][4100], pre[4100][26], pr[4100][26];
void init() {
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s%s", a + 1, b + 1);
  n = strlen(a + 1), m = strlen(b + 1);
  memset(pre[0], 0, sizeof(pre[0]));
  memset(pr[0], 0, sizeof(pr[0]));
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 25; ++j) pre[i][j] = pre[i - 1][j];
    pre[i][a[i] - 'a'] = i;
  }
  for (int i = 1; i <= m; ++i) {
    for (int j = 0; j <= 25; ++j) pr[i][j] = pr[i - 1][j];
    pr[i][b[i] - 'a'] = i;
  }
}
void work() {
  memset(f, 1, sizeof(f));
  f[0][0] = 0;
  for (int i = 1; i <= n; ++i) f[i][0] = td * i;
  for (int i = 1; i <= m; ++i) f[0][i] = ti * i;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (a[i] == b[j]) f[i][j] = f[i - 1][j - 1];
      if (f[i][j] > f[i - 1][j] + td) f[i][j] = f[i - 1][j] + td;
      if (f[i][j] > f[i][j - 1] + ti) f[i][j] = f[i][j - 1] + ti;
      if (f[i][j] > f[i - 1][j - 1] + tr) f[i][j] = f[i - 1][j - 1] + tr;
      if (pre[i - 1][b[j] - 'a'] > 0 && pr[j - 1][a[i] - 'a'] > 0) {
        int k = pre[i - 1][b[j] - 'a'], l = pr[j - 1][a[i] - 'a'];
        if (f[k - 1][l - 1] + te + td * (i - k - 1) + ti * (j - l - 1) <
            f[i][j])
          f[i][j] = f[k - 1][l - 1] + te + td * (i - k - 1) + ti * (j - l - 1);
      }
    }
  printf("%d\n", f[n][m]);
}
int main() {
  init();
  work();
  return 0;
}
