#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
vector<int> Z_maker(string s, int n) {
  vector<int> z(n);
  z[0] = n;
  int L = 0, R = 0, i, x;
  for (i = 1; i < n; i++) {
    if (R < i || z[i - L] >= R - i + 1) {
      R < i ? x = i : x = R + 1;
      while (x < n && s[x] == s[x - i]) x++;
      z[i] = x - i;
      if (i < x) {
        L = i;
        R = x - 1;
      }
    } else
      z[i] = z[i - L];
  }
  return z;
}
int n, t[1000009];
long long u[1000009];
void inc(int x, int v) {
  x += 500003;
  for (; x; x >>= 1) t[x] += v;
}
void inc2(int x, int v) {
  x += 500003;
  for (; x; x >>= 1) u[x] += v;
}
long long que(int l, int r) {
  long long z = 0;
  for (l += 500003, r += 500003; l < r; l >>= 1, r >>= 1) {
    if (l & 1) z += t[l], l++;
    if (r & 1) r--, z += t[r];
  }
  return z;
}
long long que2(int l, int r) {
  long long z = 0;
  for (l += 500003, r += 500003; l < r; l >>= 1, r >>= 1) {
    if (l & 1) z += u[l], l++;
    if (r & 1) r--, z += u[r];
  }
  return z;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  long long z = 0;
  string a, b, s;
  cin >> n >> m >> a >> b >> s;
  vector<int> c = Z_maker(s + '!' + a, n + m + 1), d, e;
  for (int i = m + 1; i <= m + n; i++) d.push_back(c[i]);
  reverse(b.begin(), b.end());
  reverse(s.begin(), s.end());
  c = Z_maker(s + '!' + b, n + m + 1);
  for (int i = m + 1; i <= m + n; i++) e.push_back(c[i]);
  reverse(e.begin(), e.end());
  if (n < m) {
    for (int i = 0; i < n; i++)
      if (e[i]) inc(e[i], 1), inc2(e[i], e[i]);
    for (int i = 0; i < n; i++) {
      z += que2(m - d[i], 500003) + que(m - d[i], 500003) * (d[i] - m + 1);
    }
  } else {
    for (int i = 0; i < m - 1; i++)
      if (e[i]) inc(e[i], 1), inc2(e[i], e[i]);
    for (int i = 0; i < n; i++) {
      if (d[i] >= m) {
        z += que2(0, m) + que(m, 500003) * (m - 1);
      } else {
        z += que2(m - d[i], m) + que(m - d[i], m) * (d[i] - m + 1) +
             que(m, 500003) * d[i];
      }
      if (e[i]) inc(e[i], -1);
      if (e[i]) inc2(e[i], -e[i]);
      if (i + m - 1 < n)
        if (e[i + m - 1]) inc(e[i + m - 1], 1);
      if (i + m - 1 < n)
        if (e[i + m - 1]) inc2(e[i + m - 1], e[i + m - 1]);
    }
  }
  cout << z;
}
