#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 4100;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
long long dp[maxn][maxn];
long long lasts[700];
long long lastt[700];
char s[maxn];
char t[maxn];
int main() {
  long long ti, td, tr, te;
  cin >> ti >> td >> tr >> te;
  cin >> s + 1 >> t + 1;
  long long n = strlen(s + 1);
  long long m = strlen(t + 1);
  for (long long i = 1; i <= m; i++) {
    dp[0][i] = ti * i;
  }
  for (long long i = 1; i <= n; i++) {
    lasts[s[i]] = i;
    for (long long j = 0; j < 700; j++) {
      lastt[j] = 0;
    }
    dp[i][0] = td * i;
    for (long long j = 1; j <= m; j++) {
      lastt[t[j]] = j;
      if (s[i] == t[j]) {
        dp[i][j] = dp[i - 1][j - 1];
      } else {
        dp[i][j] = dp[i - 1][j - 1] + tr;
        dp[i][j] = min(dp[i][j], dp[i - 1][j] + td);
        dp[i][j] = min(dp[i][j], dp[i][j - 1] + ti);
        long long v = lastt[s[i]];
        long long u = lasts[t[j]];
        if (v != 0 && u != 0)
          dp[i][j] = min(dp[i][j], td * (i - u - 1) + te + ti * (j - v - 1) +
                                       dp[u - 1][v - 1]);
        if (v != 0 && i >= 2)
          dp[i][j] =
              min(dp[i][j], te + tr + ti * (j - v - 1) + dp[i - 2][v - 1]);
        if (u != 0 && j >= 2)
          dp[i][j] =
              min(dp[i][j], td * (i - u - 1) + te + tr + dp[u - 1][j - 2]);
      }
    }
  }
  cout << dp[n][m];
}
