#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int p = 1299827;
char a[500005], b[500005], s[1000005];
long long pi[1000005], x[1000005], y[1000005], z[1000005];
int n, m;
int R[500005], L[500005];
bool func1(int l1, int r1, int l2, int r2) {
  return (x[r1] - x[l1 - 1] + mod) * pi[2 * n - r1] % mod ==
         (z[r2] - z[l2 - 1] + mod) * pi[2 * n - r2] % mod;
}
bool func2(int l1, int r1, int l2, int r2) {
  return (y[r1] - y[l1 - 1] + mod) * pi[2 * n - r1] % mod ==
         (z[r2] - z[l2 - 1] + mod) * pi[2 * n - r2] % mod;
}
struct fenwick {
  long long ft[1000005];
  void update(int i, int v) {
    for (; i <= 1000000; i += (i & -i)) ft[i] += v;
  }
  long long query(int i) {
    long long ans = 0;
    for (; i > 0; i -= (i & -i)) ans += ft[i];
    return ans;
  }
} f[2];
int main() {
  scanf("%d%d", &n, &m);
  pi[0] = 1;
  for (int i = 1; i <= n + n; i++) pi[i] = pi[i - 1] * p % mod;
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  scanf("%s", s + 1);
  x[0] = y[0] = 1;
  for (int i = 1; i <= n; i++) {
    x[i] = (x[i - 1] + a[i] * pi[i]) % mod;
    y[i] = (y[i - 1] + b[i] * pi[i]) % mod;
  }
  for (int i = 1; i <= m; i++) {
    z[i] = (z[i - 1] + s[i] * pi[i]) % mod;
  }
  for (int i = 1; i <= n; i++) {
    int lo = 1, hi = min(n - i + 1, m - 1);
    while (lo <= hi) {
      int mid = (lo + hi) / 2;
      if (func1(i, i + mid - 1, 1, mid))
        R[i] = mid, lo = mid + 1;
      else
        hi = mid - 1;
    }
    lo = 1, hi = min(i, m - 1);
    while (lo <= hi) {
      int mid = (lo + hi) / 2;
      if (func2(i - mid + 1, i, m - mid + 1, m))
        L[i] = mid, lo = mid + 1;
      else
        hi = mid - 1;
    }
  }
  long long ans = 0;
  int j = 1;
  for (int i = 1; i <= n; i++) {
    while (j <= min(n, i + m - 2)) {
      if (L[j] != 0) {
        f[0].update(L[j], L[j]);
        f[1].update(L[j], 1);
      }
      j++;
    }
    ans += (f[1].query(m) - f[1].query(m - R[i] - 1)) * 1ll * R[i] +
           (f[0].query(m) - f[0].query(m - R[i] - 1)) -
           (f[1].query(m) - f[1].query(m - R[i] - 1)) * 1ll * (m - 1);
    if (L[i] != 0) {
      f[0].update(L[i], -L[i]);
      f[1].update(L[i], -1);
    }
  }
  printf("%lld\n", ans);
}
