#include <bits/stdc++.h>
using namespace std;
mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template <typename T>
inline void chkmax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
inline void chkmin(T &x, T y) {
  if (x > y) x = y;
}
inline int read() {
  int x = 0;
  char c = getchar();
  while (c < 48) c = getchar();
  while (c > 47) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x;
}
const int maxn = 5e5 + 10;
char A[maxn], B[maxn], str[maxn << 1];
int n, m, valA[maxn], valB[maxn];
void exkmp(char *A, char *B, int *ans) {
  static int ext[maxn * 3];
  static char str[maxn * 3];
  memset(ext, 0, sizeof ext);
  ext[1] = m;
  str[m + 1] = '#';
  for (int i = (1), iend = (m); i <= iend; ++i) str[i] = B[i];
  for (int i = (1), iend = (n); i <= iend; ++i) str[m + i + 1] = A[i];
  int len = n + m + 1, pos = 0, mx = 0;
  for (int i = (2), iend = (len); i <= iend; ++i) {
    if (i <= mx) ext[i] = min(ext[i - pos + 1], mx - i + 1);
    while (str[ext[i] + 1] == str[i + ext[i]]) ++ext[i];
    if (mx < i + ext[i] - 1) pos = i, mx = i + ext[i] - 1;
  }
  for (int i = (1), iend = (n); i <= iend; ++i)
    ans[i] = min(ext[m + i + 1], m - 1);
}
int c[maxn << 1];
long long sum[maxn << 1];
void add(int pos, int x) {
  int val = pos * x;
  for (; pos; pos &= pos - 1) {
    c[pos] += x, sum[pos] += val;
  }
}
pair<int, long long> query(int pos) {
  int cnt = 0;
  long long res = 0;
  for (; pos <= m; pos += pos & -pos) {
    cnt += c[pos], res += sum[pos];
  }
  return pair<int, long long>(cnt, res);
}
int main() {
  cin >> n >> m;
  scanf("%s %s %s", A + 1, B + 1, str + 1);
  exkmp(A, str, valA);
  reverse(B + 1, B + n + 1);
  reverse(str + 1, str + m + 1);
  exkmp(B, str, valB);
  reverse(valB + 1, valB + n + 1);
  long long res = 0;
  for (int i = (n), iend = (1); i >= iend; --i) {
    int r = min(n, i + m - 2);
    add(valB[i], 1);
    if (r < n) add(valB[r + 1], -1);
    pair<int, long long> p = query(m - valA[i]);
    res += p.second + 1ll * p.first * (valA[i] - m + 1);
  }
  cout << res;
  return 0;
}
