#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
struct SA {
  int sa[maxn], rec[maxn], cnt[maxn], val[maxn], stk[maxn], lcp[maxn], tp, len,
      stp;
  bool less2(int i, int j) {
    if (val[i] != val[j]) return 0;
    int ri = i + stp < len ? val[i + stp] : -1;
    int rj = j + stp < len ? val[j + stp] : -1;
    return ri == rj;
  }
  void build(string &s) {
    len = s.length();
    int lim = 26;
    for (int i = 0; i < lim; i++) cnt[i] = 0;
    for (int i = 0; i < len; i++) cnt[val[i] = (s[i] - 'a')]++;
    for (int i = 1; i < lim; i++) cnt[i] += cnt[i - 1];
    for (int i = len - 1; i >= 0; i--) sa[--cnt[val[i]]] = i;
    for (stp = 1;; stp *= 2) {
      tp = 0;
      for (int i = 0; i < len; i++)
        if (sa[i] + stp >= len) stk[tp++] = sa[i];
      for (int i = 0; i < len; i++)
        if (sa[i] >= stp) stk[tp++] = sa[i] - stp;
      for (int i = 0; i < lim; i++) cnt[i] = 0;
      for (int i = 0; i < len; i++) cnt[val[i]]++;
      for (int i = 1; i < lim; i++) cnt[i] += cnt[i - 1];
      for (int i = len - 1; i >= 0; i--) sa[--cnt[val[stk[i]]]] = stk[i];
      lim = 0;
      for (int i = 0; i < len; lim++) {
        int j = i;
        while (j < len - 1 && less2(sa[j], sa[j + 1])) j++;
        while (i <= j) {
          rec[sa[i]] = lim;
          i++;
        }
      }
      for (int i = 0; i < len; i++) val[i] = rec[i];
      if (lim == len) break;
    }
    for (int i = 0; i < len; i++) {
      rec[sa[i]] = i;
    }
    lcp[0] = 0;
    int h = 0;
    for (int i = 0; i < len; i++) {
      if (rec[i] == 0) continue;
      int j = sa[rec[i] - 1];
      if (h > 0) h--;
      for (; i + h < len && j + h < len; h++)
        if (s[i + h] != s[j + h]) break;
      lcp[rec[i]] = h;
    }
    for (int i = 0; i < len; i++) {
    }
  }
} aa, bb;
struct BIT {
  int bit[maxn];
  void add(int x, int v) {
    x++;
    while (x < maxn) {
      bit[x] += v;
      x += x & -x;
    }
  }
  int sum(int x) {
    x++;
    int ret = 0;
    while (x > 0) {
      ret += bit[x];
      x -= x & -x;
    }
    return ret;
  }
  int query(int x, int y) { return sum(y) - sum(x - 1); }
} fa, fb;
char a[maxn], b[maxn], s[maxn * 2];
int n, m;
string tmp;
int Al[maxn], Ar[maxn], Bl[maxn], Br[maxn];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", a);
  scanf("%s", b);
  reverse(b, b + n);
  scanf("%s", s);
  tmp = a;
  aa.build(tmp);
  tmp = b;
  bb.build(tmp);
  memset(Al, -1, sizeof(Al));
  memset(Ar, -1, sizeof(Ar));
  for (int i = 0; i < n; i++) {
    if (a[aa.sa[i]] == s[0]) {
      Al[1] = i;
      break;
    }
  }
  if (Al[1] == -1) {
    printf("0\n");
    return 0;
  }
  Ar[1] = Al[1];
  while (Ar[1] + 1 < n && a[aa.sa[Ar[1] + 1]] == s[0]) Ar[1]++;
  for (int len = 2; len <= n && len <= m; len++) {
    Al[len] = Al[len - 1];
    Ar[len] = Ar[len - 1];
    if (Al[len] == -1) break;
    while (Al[len] <= Ar[len] && (aa.sa[Al[len]] + len - 1 >= n ||
                                  a[aa.sa[Al[len]] + len - 1] != s[len - 1]))
      Al[len]++;
    while (Al[len] <= Ar[len] && (aa.sa[Ar[len]] + len - 1 >= n ||
                                  a[aa.sa[Ar[len]] + len - 1] != s[len - 1]))
      Ar[len]--;
    if (Al[len] > Ar[len]) {
      Al[len] = Ar[len] = -1;
      break;
    }
  }
  memset(Bl, -1, sizeof(Bl));
  memset(Br, -1, sizeof(Br));
  for (int i = 0; i < n; i++) {
    if (b[bb.sa[i]] == s[m - 1]) {
      Bl[1] = i;
      break;
    }
  }
  if (Bl[1] == -1) {
    printf("0\n");
    return 0;
  }
  Br[1] = Bl[1];
  while (Br[1] + 1 < n && b[bb.sa[Br[1] + 1]] == s[m - 1]) Br[1]++;
  for (int len = 2; len <= n && len <= m; len++) {
    Bl[len] = Bl[len - 1];
    Br[len] = Br[len - 1];
    if (Bl[len] == -1) break;
    while (Bl[len] <= Br[len] && (bb.sa[Bl[len]] + len - 1 >= n ||
                                  b[bb.sa[Bl[len]] + len - 1] != s[m - len]))
      Bl[len]++;
    while (Bl[len] <= Br[len] && (bb.sa[Br[len]] + len - 1 >= n ||
                                  b[bb.sa[Br[len]] + len - 1] != s[m - len]))
      Br[len]--;
    if (Bl[len] > Br[len]) {
      Bl[len] = Br[len] = -1;
      break;
    }
  }
  for (int i = 0; i < n; i++) fa.add(i, 1);
  int cural = 0, curar = n - 1;
  int curbl = -1, curbr = -1;
  long long ans = 0, cur = 0;
  for (int len = 1; len < m && len <= n; len++) {
    if (Al[len] == -1) break;
    while (cural < Al[len]) {
      cur -= fb.query(aa.sa[cural], min(n - 1, aa.sa[cural] + m - 2));
      fa.add(aa.sa[cural], -1);
      cural++;
    }
    while (curar > Ar[len]) {
      cur -= fb.query(aa.sa[curar], min(n - 1, aa.sa[curar] + m - 2));
      fa.add(aa.sa[curar], -1);
      curar--;
    }
    if (m - len > n || Bl[m - len] == -1) continue;
    if (curbl == -1) {
      curbl = Bl[m - len] + 1;
      curbr = Bl[m - len];
    }
    while (curbl > Bl[m - len]) {
      curbl--;
      cur +=
          fa.query(max(0, n - 1 - bb.sa[curbl] - m + 2), n - 1 - bb.sa[curbl]);
      fb.add(n - 1 - bb.sa[curbl], 1);
    }
    while (curbr < Br[m - len]) {
      curbr++;
      cur +=
          fa.query(max(0, n - 1 - bb.sa[curbr] - m + 2), n - 1 - bb.sa[curbr]);
      fb.add(n - 1 - bb.sa[curbr], 1);
    }
    ans += cur;
  }
  printf("%I64d\n", ans);
  return 0;
}
