#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
char a[N], b[N], s[N];
int n, m;
vector<int> getZ(string& s) {
  vector<int> res(s.size());
  int n = s.size();
  int L, R, k;
  L = R = 0;
  for (int i = 1; i < n; ++i) {
    if (i > R) {
      L = R = i;
      while (R < n && s[R - L] == s[R]) R++;
      res[i] = R - L;
      R--;
    } else {
      k = i - L;
      if (res[k] < R - i + 1)
        res[i] = res[k];
      else {
        L = i;
        while (R < n && s[R - L] == s[R]) R++;
        res[i] = R - L;
        R--;
      }
    }
  }
  return res;
}
int mxPre[N], mxSuf[N];
long long dp[N * 8];
long long laz[N * 8];
void up(int p, int l, int h) {
  if (!laz[p]) return;
  int m = (l + h) / 2;
  laz[2 * p] += laz[p];
  laz[2 * p + 1] += laz[p];
  dp[2 * p + 1] += laz[p] * (h - m);
  dp[2 * p] += laz[p] * (m - l + 1);
  laz[p] = 0;
}
void add(int a, int b, long long x, int l = 1, int h = m - 1, int p = 1) {
  if (a == l && b == h) {
    dp[p] += x * (h - l + 1);
    laz[p] += x;
    return;
  }
  up(p, l, h);
  int m = (l + h) / 2;
  if (b <= m) {
    add(a, b, x, l, m, 2 * p);
  } else if (a > m) {
    add(a, b, x, m + 1, h, 2 * p + 1);
  } else {
    add(a, m, x, l, m, 2 * p);
    add(m + 1, b, x, m + 1, h, 2 * p + 1);
  }
  dp[p] = dp[2 * p] + dp[2 * p + 1];
}
long long cal(int a, int b, long long x = 0, int l = 1, int h = m - 1,
              int p = 1) {
  if (a == l && b == h) {
    return dp[p];
  }
  up(p, l, h);
  int m = (l + h) / 2;
  if (b <= m) {
    return cal(a, b, x, l, m, 2 * p);
  } else if (a > m) {
    return cal(a, b, x, m + 1, h, 2 * p + 1);
  } else {
    return cal(a, m, x, l, m, 2 * p) + cal(m + 1, b, x, m + 1, h, 2 * p + 1);
  }
}
int main() {
  cin >> n >> m;
  scanf("%s%s%s", a, b, s);
  string te = string(s) + "@" + string(a);
  vector<int> fail = getZ(te);
  for (int i = m + 1; i < fail.size(); i++) {
    mxPre[i - m - 1] = fail[i];
  }
  reverse(s, s + m);
  reverse(b, b + n);
  te = string(s) + "@" + string(b);
  fail = getZ(te);
  for (int i = m + 1; i < fail.size(); i++) {
    mxSuf[i - m - 1] = fail[i];
  }
  reverse(mxSuf, mxSuf + n);
  int en = 0;
  long long res = 0;
  for (int i = 0; i < n; i++) {
    while (en < n && en - i + 1 < m) {
      if (mxSuf[en]) {
        add(max(1, (m - mxSuf[en])), m - 1, 1);
      }
      en++;
    }
    if (mxPre[i]) res += cal(1, min(mxPre[i], m - 1));
    if (mxSuf[i]) add(max(1, (m - mxSuf[i])), m - 1, -1);
  }
  cout << res << endl;
  return 0;
}
