#include <bits/stdc++.h>
using namespace std;
int n, m, ex1[500005], ex2[500005], nxt[1000005];
long long ans;
char a[500005], b[500005], s[1000005];
void Z(char *s, int n) {
  memset(nxt, 0, (n + 1) << 2), nxt[1] = n;
  for (int i = 2, l, r = 0; i <= n; i++) {
    if (i <= r) nxt[i] = min(nxt[i - l + 1], r - i + 1);
    while (s[i + nxt[i]] == s[nxt[i] + 1]) nxt[i]++;
    if (i + nxt[i] - 1 > r) l = i, r = i + nxt[i] - 1;
  }
}
void exkmp(char *s, int n, char *t, int m, int *ex) {
  Z(t, m), memset(ex, 0, (n + 1) << 2);
  for (int i = 1, l, r = 0; i <= n; i++) {
    if (i <= r) ex[i] = min(nxt[i - l + 1], r - i + 1);
    while (i + ex[i] <= n && s[i + ex[i]] == t[ex[i] + 1]) ex[i]++;
    if (i + ex[i] - 1 > r) l = i, r = i + ex[i] - 1;
  }
}
struct BIT {
  long long a[1000005];
  void upd(int i, int v) {
    for (; i <= m; i += i & -i) a[i] += v;
  }
  long long qsum(int i) {
    long long s = 0;
    for (; i; i -= i & -i) s += a[i];
    return s;
  }
} T1, T2;
int main() {
  scanf("%d%d%s%s%s", &n, &m, a + 1, b + 1, s + 1);
  exkmp(a, n, s, m, ex1);
  reverse(s + 1, s + 1 + m), reverse(b + 1, b + 1 + n), exkmp(b, n, s, m, ex2),
      reverse(ex2 + 1, ex2 + 1 + n);
  for (int i = 1, j = 1, x; i <= n; i++) {
    for (; j <= min(i + m - 2, n); j++) {
      if (ex2[j] == m) ex2[j]--;
      x = m - ex2[j], T1.upd(x, 1), T2.upd(x, x);
    }
    if (ex1[i] == m) ex1[i]--;
    x = ex1[i] + 1, ans += T1.qsum(x) * x - T2.qsum(x);
    x = m - ex2[i], T1.upd(x, -1), T2.upd(x, -x);
  }
  printf("%lld\n", ans);
}
