#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
int n, m;
char a[maxn], b[maxn], s[maxn];
int l[maxn], r[maxn], nxt[maxn];
unsigned long long pw[maxn];
unsigned long long hsget(unsigned long long *hs, int l, int r) {
  int L = r - l + 1;
  if (l == 0) return hs[r];
  return (hs[r] - pw[L] * hs[l - 1] % mod + mod) % mod;
}
void get(char *s, char *a, int *p) {
  static unsigned long long hs[maxn], ha[maxn];
  hs[0] = s[0];
  for (int i = 1; i < m; i++) {
    hs[i] = (hs[i - 1] * 131 % mod + s[i]) % mod;
  }
  ha[0] = a[0];
  for (int i = 1; i < n; i++) {
    ha[i] = (ha[i - 1] * 131 % mod + a[i]) % mod;
  }
  for (int i = 0; i < n; i++) {
    int l = 0, r = min(m - 1, n - 1 - i);
    while (l <= r) {
      int mid = l + r >> 1;
      if (hs[mid] == hsget(ha, i, i + mid))
        l = mid + 1;
      else
        r = mid - 1;
    }
    p[i] = r;
  }
}
struct node {
  int pos, l;
  bool operator<(const node &a) const { return l > a.l; }
} ka[maxn], kb[maxn];
struct notree {
  int num;
  long long sum;
  notree operator+(const notree &a) const { return {num + a.num, sum + a.sum}; }
} tr[maxn << 2];
void pushdown(int rt, int son) { tr[son] = tr[son] + tr[rt]; }
void update(int L, int R, int l, int r, int k, int c) {
  if (L > r || l > R) return;
  if (L <= l && R >= r) {
    tr[k].num += 1;
    tr[k].sum += c;
    return;
  }
  pushdown(k, k << 1);
  pushdown(k, k << 1 | 1);
  tr[k].num = tr[k].sum = 0;
  int mid = l + r >> 1;
  update(L, R, l, mid, k * 2, c);
  update(L, R, mid + 1, r, k * 2 + 1, c);
}
notree query(int pos, int l, int r, int k) {
  if (pos > r || pos < l) return {0, 0};
  if (pos == l && r == pos) {
    return tr[k];
  }
  pushdown(k, k << 1);
  pushdown(k, k << 1 | 1);
  tr[k].num = tr[k].sum = 0;
  int mid = l + r >> 1;
  return query(pos, l, mid, k * 2) + query(pos, mid + 1, r, k * 2 + 1);
}
long long ans;
int main() {
  pw[0] = 1;
  for (int i = 1; i < maxn; i++) pw[i] = pw[i - 1] * 131 % mod;
  scanf("%d%d%s%s%s", &n, &m, a, b, s);
  get(s, a, l);
  reverse(s, s + m);
  reverse(b, b + n);
  get(s, b, r);
  reverse(r, r + n);
  for (int i = 0; i < n; i++) {
    l[i]++;
    if (l[i] == m) l[i]--;
    ka[i] = {i + 1, l[i]};
    r[i] = m - r[i];
    if (r[i] == 1) r[i]++;
    kb[i] = {i + 1, r[i]};
  }
  sort(ka, ka + n);
  sort(kb, kb + n);
  int u = -1;
  notree v;
  for (int i = 0; i < n; i++) {
    while (u < n && kb[u + 1].l > ka[i].l + 1) {
      u++;
      if (kb[u].l == m + 1) continue;
      v = query(kb[u].pos, 1, n, 1);
      ans += 1ll * (-kb[u].l + 2) * v.num + v.sum;
    }
    update(ka[i].pos, min(ka[i].pos + m - 2, n), 1, n, 1, ka[i].l);
  }
  while (u < n) {
    u++;
    notree v = query(kb[u].pos, 1, n, 1);
    ans += 1ll * (-kb[u].l + 2) * v.num + v.sum;
  }
  cout << ans << '\n';
}
