#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch - '0' < 0 || ch - '0' > 9) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch - '0' >= 0 && ch - '0' <= 9) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int N, M, W, z[500010 * 3], zp[500010], zs[500010];
char s1[500010], s2[500010], t1[500010 * 2], t2[500010 * 2];
char s[500010 * 3];
long long b1[500010 * 2], b2[500010 * 2], Ans;
int lowbit(int x) { return x & (-x); }
long long query(long long *b, int i) {
  long long ans = 0;
  for (; i; i -= lowbit(i)) ans += b[i];
  return ans;
}
void add(long long *b, int i, long long x) {
  for (; i <= M; i += lowbit(i)) b[i] += x;
}
long long query(int i) { return query(b2, M - i) - (i - 1) * query(b1, M - i); }
void modify(int p, int t) {
  int l = min(M - 1, zp[p]);
  add(b1, M - l, t);
  add(b2, M - l, t * l);
}
void Z(char *S, int n, int *Z) {
  Z[1] = n;
  for (int i = 2; i <= n; i++) Z[i] = 0;
  int l = 0, r = 0;
  for (int i = 2; i <= n; i++) {
    if (i <= r) Z[i] = min(r - i + 1, Z[i - l + 1]);
    while (S[i + Z[i]] == S[1 + Z[i]] && i + Z[i] <= n) ++Z[i];
    if (r < i + Z[i] - 1) {
      l = i;
      r = i + Z[i] - 1;
    }
  }
}
void pre_1() {
  reverse(s2 + 1, s2 + N + 1);
  for (int i = 1; i <= M; i++) t2[i] = t1[M - i + 1];
  s[M + 1] = 'A';
  for (int i = 1; i <= N; i++) s[M + i + 1] = s1[i];
  for (int i = 1; i <= M; i++) s[i] = t1[i];
  Z(s, M + 1 + N, z);
}
void pre_2() {
  s[M + 1] = 'A';
  for (int i = 1; i <= N; i++) zp[i] = z[M + i + 1];
  for (int i = 1; i <= M; i++) s[i] = t2[i];
  for (int i = 1; i <= N; i++) s[M + i + 1] = s2[i];
  Z(s, M + 1 + N, z);
}
int main() {
  N = read();
  M = read();
  scanf("%s%s%s", s1 + 1, s2 + 1, t1 + 1);
  pre_1();
  pre_2();
  for (int i = 1; i <= N; i++) zs[i] = z[M + N - i + 2];
  int l;
  for (int i = 1; i <= N; i++) {
    modify(i, 1);
    if (i >= M) modify(i + 1 - M, -1);
    l = min(M - 1, zs[i]);
    if (!l) continue;
    Ans += query(M - l);
  }
  printf("%lld\n", Ans);
  return 0;
}
