#include <bits/stdc++.h>
using namespace std;
int dumerau[4001][4001];
int lasti1[4001][128], lasti2[4001][128];
int main(void) {
  int tins, tdel, trepl, texch;
  cin >> tins >> tdel >> trepl >> texch;
  string s1, s2;
  cin >> s1 >> s2;
  int n = (int)s1.length();
  int m = (int)s2.length();
  for (int i = 0; i < 128; i++) {
    lasti1[0][i] = lasti2[0][i] = -1;
  }
  for (int i = 0; i < n; i++) {
    memcpy(lasti1[i + 1], lasti1[i], sizeof(lasti1[i]));
    lasti1[i + 1][s1[i]] = i;
  }
  for (int i = 0; i < m; i++) {
    memcpy(lasti2[i + 1], lasti2[i], sizeof(lasti2[i]));
    lasti2[i + 1][s2[i]] = i;
  }
  dumerau[0][0] = 0;
  for (int i = 1; i <= m; i++) {
    dumerau[0][i] = tins + dumerau[0][i - 1];
  }
  for (int i = 1; i <= n; i++) {
    dumerau[i][0] = tdel + dumerau[i - 1][0];
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      dumerau[i][j] = min(dumerau[i - 1][j] + tdel, dumerau[i][j - 1] + tins);
      dumerau[i][j] =
          min(dumerau[i][j],
              dumerau[i - 1][j - 1] + ((s1[i - 1] == s2[j - 1]) ? 0 : trepl));
      int prev1 = lasti1[i - 1][s2[j - 1]];
      int prev2 = lasti2[j - 1][s1[i - 1]];
      if (prev1 != -1 && prev2 != -1)
        dumerau[i][j] = min(dumerau[i][j], dumerau[prev1][prev2] + texch +
                                               (i - prev1 - 2) * tdel +
                                               (j - prev2 - 2) * tins);
    }
  cout << dumerau[n][m] << endl;
  return 0;
}
