#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int ti, td, tr, te;
int n, m;
char a[4001];
char b[4001];
int dp[4002][4002];
int next1[4002][26];
int next2[4002][26];
int go(int i, int j) {
  if (i == n) return (m - j) * ti;
  if (j == m) return (n - i) * td;
  if (dp[i][j] != -1) return dp[i][j];
  int ret = 0x7f7f7f7f, tmp = 0;
  tmp = go(i + 1, j) + td;
  ret = min(ret, tmp);
  tmp = go(i, j + 1) + ti;
  ret = min(ret, tmp);
  tmp = go(i + 1, j + 1) + tr;
  ret = min(ret, tmp);
  if (a[i] == b[j]) {
    tmp = go(i + 1, j + 1);
    ret = min(ret, tmp);
  }
  int l1 = next1[i + 1][b[j] - 'a'];
  int l2 = next2[j + 1][a[i] - 'a'];
  if (l1 != -1 && l2 != -1) {
    tmp = (l1 - i - 1) * td + te + (l2 - j - 1) * ti + go(l1 + 1, l2 + 1);
    ret = min(ret, tmp);
  }
  return dp[i][j] = ret;
}
void solution() {
  scanf("%d %d %d %d\n", &ti, &td, &tr, &te);
  gets(a);
  n = strlen(a);
  gets(b);
  m = strlen(b);
  for (int i = 0, _n = (26); i < _n; ++i) next1[n][i] = -1;
  for (int i = (n)-1; i >= 0; --i) {
    for (int j = 0, _n = (26); j < _n; ++j) next1[i][j] = next1[i + 1][j];
    next1[i][a[i] - 'a'] = i;
  }
  for (int i = 0, _n = (26); i < _n; ++i) next2[m][i] = -1;
  for (int i = (m)-1; i >= 0; --i) {
    for (int j = 0, _n = (26); j < _n; ++j) next2[i][j] = next2[i + 1][j];
    next2[i][b[i] - 'a'] = i;
  }
  memset((dp), (-1), sizeof((dp)));
  int ret = go(0, 0);
  printf("%d\n", ret);
}
int main() {
  solution();
  return 0;
}
