#include <bits/stdc++.h>
using namespace std;
const int maxN = 4000 + 5;
const int mod = 1000 * 1000 * 1000 + 7;
int dp[maxN][maxN];
int ps[30], pl[30];
int main() {
  ios::sync_with_stdio(0);
  cin.tie();
  int ti, td, tr, te;
  cin >> ti >> td >> tr >> te;
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size();
  memset(dp, 63, sizeof dp);
  for (int i = 0; i < n + 1; i++) dp[i][0] = i * td;
  for (int i = 0; i < m + 1; i++) dp[0][i] = i * ti;
  memset(pl, -1, sizeof pl);
  for (int i = 1; i < n + 1; i++) {
    memset(ps, -1, sizeof ps);
    for (int j = 1; j < m + 1; j++) {
      if (s[i - 1] == t[j - 1]) {
        dp[i][j] = dp[i - 1][j - 1];
        ps[t[j - 1] - 'a'] = j;
        continue;
      }
      dp[i][j] = min(dp[i - 1][j - 1] + tr, dp[i - 1][j] + td);
      dp[i][j] = min(dp[i][j], dp[i][j - 1] + ti);
      if (i == 1 || j == 1 || pl[t[j - 1] - 'a'] == -1 ||
          ps[s[i - 1] - 'a'] == -1) {
        ps[t[j - 1] - 'a'] = j;
        continue;
      }
      int tmp = (i - pl[t[j - 1] - 'a'] - 1) * td + te +
                ti * (j - ps[s[i - 1] - 'a'] - 1) +
                dp[pl[t[j - 1] - 'a'] - 1][ps[s[i - 1] - 'a'] - 1];
      dp[i][j] = min(dp[i][j], tmp);
      ps[t[j - 1] - 'a'] = j;
    }
    pl[s[i - 1] - 'a'] = i;
  }
  cout << dp[n][m] << endl;
  return 0;
}
