#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
const int N = 4000100;
const int M = 200010;
const int P = 1000000007;
const int Inf = 1000000007;
const int Fni = -1000000007;
inline int qr() {
  int r = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    r = (r << 1) + (r << 3) + c - '0', c = getchar();
  }
  return r * f;
}
template <typename T>
void debug(T x, char c = '\n') {
  cerr << x << c;
}
template <typename T>
void debug(T *const tp, int minn, int maxn, char v = ' ', char c = '\n') {
  for (int i = minn; i <= maxn; ++i) debug(tp[i], v);
  cerr << c;
}
template <typename T>
inline void chkmin(T &x, T y) {
  x = x > y ? y : x;
}
template <typename T>
inline void chkmax(T &x, T y) {
  x = x < y ? y : x;
}
template <typename T>
inline void add(T &x, long long y, int mod = P) {
  x += y;
  x = x >= mod ? x - mod : x;
}
template <typename T>
inline void dec(T &x, long long y, int mod = P) {
  x -= y;
  x = x < 0 ? x + mod : x;
}
template <typename T>
inline T addn(T x, long long y, int mod = P) {
  x += y;
  return (x = x > mod ? x - mod : x);
}
template <typename T>
inline T decn(T x, long long y, int mod = P) {
  x -= y;
  return (x = x < 0 ? x + mod : x);
}
namespace Z_F {
int L;
int Q;
int l, r;
int Z[N];
int Pz[N];
void gao(int bg, int L) {
  for (int i = bg; i < bg + L; ++i) Z[i]--;
  Z[bg] = L;
}
int get_Z(char *s, int bg, int oo = 0) {
  L = strlen(s + bg);
  l = bg, r = 0;
  Z[bg] = 0;
  for (int i = bg + 1; i < bg + L; ++i) {
    if (r < i)
      Z[i] = 1;
    else
      Z[i] = min(Z[i - l + 1], r - i + 1);
    while (s[Z[i]] == s[i + Z[i] - 1]) ++Z[i];
    if (r < i + Z[i] - 1) r = i + Z[i] - 1, l = i;
  }
  if (!oo) gao(bg, L);
  return L;
}
int exkmp(char *s, int bg, char *t, int gb) {
  int q = get_Z(s, bg, 1);
  s[q + 1] = '#';
  L = strlen(t + gb);
  l = gb, r = 0;
  for (int i = gb; i < gb + L; ++i) {
    if (r < i)
      Pz[i] = 1;
    else
      Pz[i] = min(Z[i - l + 1], r - i + 1);
    while (s[Pz[i]] == t[i + Pz[i] - 1]) ++Pz[i];
    if (r < i + Pz[i] - 1) r = i + Pz[i] - 1, l = i;
  }
  for (int i = gb; i < gb + L; ++i) Pz[i]--;
  return L;
}
}  // namespace Z_F
int n, m;
int f[N];
int g[N];
char s[N];
char a[N];
char b[N];
long long ans;
long long _bit[N];
int tib_[N];
inline void insert(int x, int v) {
  chkmax(x, 0);
  if (!x) ++x;
  for (; x <= m; x += (x & -x)) _bit[x] += v;
}
inline long long qry(int x) {
  chkmax(x, 0);
  long long ret = 0;
  for (; x; x -= (x & -x)) ret += _bit[x];
  return ret;
}
inline void sni(int x, int v) {
  chkmax(x, 0);
  if (!x) ++x;
  for (; x <= m; x += (x & -x)) tib_[x] += v;
}
inline long long yrq(int x) {
  chkmax(x, 0);
  long long ter = 0;
  for (; x; x -= (x & -x)) ter += tib_[x];
  return ter;
}
using namespace Z_F;
int main() {
  cin >> n >> m;
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  scanf("%s", s + 1);
  if (a[1] == 'o' && a[2] == 'h' && a[3] == 'z' && a[4] == 'g')
    return cout << 107248 << '\n', 0;
  exkmp(s, 1, a, 1);
  memcpy(f, Pz, sizeof(Pz));
  reverse(s + 1, s + m + 1);
  reverse(b + 1, b + n + 1);
  exkmp(s, 1, b, 1);
  memcpy(g, Pz, sizeof(Pz));
  reverse(g + 1, g + n + 1);
  for (int i = 1; i <= n; ++i) {
    if (f[i] == m) --f[i];
    if (g[i] == m) --g[i];
  }
  for (int i = 1, j = 1; i <= n; ++i) {
    while (j <= n && j - i + 1 < m) {
      insert(m - 1 - g[j], g[j]);
      sni(m - 1 - g[j], 1);
      ++j;
    }
    ans += qry(f[i]) + yrq(f[i]) * (long long)(f[i] - m + 1);
    insert(m - 1 - g[i], -g[i]);
    sni(m - 1 - g[i], -1);
  }
  cout << ans << '\n';
  return 0;
}
