#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long size[4000005], add[4000005];
inline void push_up(int rt) { size[rt] = size[rt << 1] + size[rt << 1 | 1]; }
inline void push_down(int rt, int l, int r) {
  if (add[rt]) {
    int m = (l + r) >> 1;
    size[rt << 1] += (m - l + 1) * add[rt];
    size[rt << 1 | 1] += (r - m) * add[rt];
    add[rt << 1] += add[rt];
    add[rt << 1 | 1] += add[rt];
    add[rt] = 0;
  }
}
void update(int rt, int l, int r, int L, int R, int v) {
  if (L <= l && r <= R) {
    size[rt] += (r - l + 1) * v;
    add[rt] += v;
    return;
  }
  push_down(rt, l, r);
  int m = (l + r) >> 1;
  if (L <= m) update(rt << 1, l, m, L, R, v);
  if (m < R) update(rt << 1 | 1, m + 1, r, L, R, v);
  push_up(rt);
}
long long query(int rt, int l, int r, int L, int R) {
  if (L <= l && r <= R) return size[rt];
  push_down(rt, l, r);
  int m = (l + r) >> 1;
  long long ans = 0;
  if (L <= m) ans += query(rt << 1, l, m, L, R);
  if (m < R) ans += query(rt << 1 | 1, m + 1, r, L, R);
  return ans;
}
int n, m;
char a[1000005], b[1000005], s[1000005];
long long Pow[1000005];
long long pan_l(long long l, long long r, long long len) {
  return (r - ((l * Pow[len]) % mod) + mod) % mod;
}
long long pan_r(long long l, long long r, long long len) {
  return (l - ((r * Pow[len]) % mod) + mod) % mod;
}
long long hash_l_a[1000005], hash_r_a[1000005], hash_l_b[1000005],
    hash_r_b[1000005], hash_l_s[1000005], hash_r_s[1000005];
int A[1000005], B[1000005];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s%s%s", a + 1, b + 1, s + 1);
  hash_l_a[1] = a[1] - 'a';
  for (int i = 2; i <= n; i++)
    hash_l_a[i] = (hash_l_a[i - 1] * 29 + a[i] - 'a') % mod;
  hash_l_b[1] = b[1] - 'a';
  for (int i = 2; i <= n; i++)
    hash_l_b[i] = (hash_l_b[i - 1] * 29 + b[i] - 'a') % mod;
  hash_l_s[1] = s[1] - 'a';
  for (int i = 2; i <= m; i++)
    hash_l_s[i] = (hash_l_s[i - 1] * 29 + s[i] - 'a') % mod;
  hash_r_a[n] = a[n] - 'a';
  for (int i = n - 1; i; i--)
    hash_r_a[i] = (hash_r_a[i + 1] * 29 + a[i] - 'a') % mod;
  hash_r_b[n] = b[n] - 'a';
  for (int i = n - 1; i; i--)
    hash_r_b[i] = (hash_r_b[i + 1] * 29 + b[i] - 'a') % mod;
  hash_r_s[m] = s[m] - 'a';
  for (int i = m - 1; i; i--)
    hash_r_s[i] = (hash_r_s[i + 1] * 29 + s[i] - 'a') % mod;
  Pow[0] = 1;
  for (int i = 1; i <= 1000000; i++) {
    Pow[i] = Pow[i - 1] * 29 % mod;
  }
  for (int i = 1; i <= n; i++) {
    int l = 0, r = min(m, n - i + 1);
    while (l < r) {
      int mid = l + r + 1 >> 1;
      if (pan_l(hash_l_a[i - 1], hash_l_a[i + mid - 1], mid) ==
              pan_l(hash_l_s[0], hash_l_s[mid], mid) &&
          pan_r(hash_r_a[i], hash_r_a[i + mid], mid) ==
              pan_r(hash_r_s[1], hash_r_s[mid + 1], mid))
        l = mid;
      else
        r = mid - 1;
    }
    A[i] = l;
  }
  for (int i = 1; i <= n; i++) {
    int l = 0, r = min(m, i);
    while (l < r) {
      int mid = l + r + 1 >> 1;
      if (pan_l(hash_l_b[i - mid], hash_l_b[i], mid) ==
              pan_l(hash_l_s[m - mid], hash_l_s[m], mid) &&
          pan_r(hash_r_b[i - mid + 1], hash_r_b[i + 1], mid) ==
              pan_r(hash_r_s[m - mid + 1], hash_r_s[m + 1], mid))
        l = mid;
      else
        r = mid - 1;
    }
    B[i] = l;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (A[i]) update(1, 1, m - 1, 1, A[i], 1);
    if (i >= m && A[i - m + 1]) update(1, 1, m - 1, 1, A[i - m + 1], -1);
    if (B[i]) ans += query(1, 1, m - 1, m - B[i], m - 1);
  }
  printf("%I64d", ans);
}
