#include <bits/stdc++.h>
using namespace std;
template <class T>
struct SegmentTree {
  std::vector<T> a, b;
  int n;
  explicit SegmentTree(int size) {
    a = std::vector<T>(size * 4);
    b = std::vector<T>(size * 4);
    n = size;
  }
  void pushDown(int l, int r, int p) {
    if (b[p]) {
      int m = (l + r) / 2;
      a[p * 2] += b[p] * (m - l + 1);
      a[p * 2 + 1] += b[p] * (r - m);
      b[p * 2] += b[p];
      b[p * 2 + 1] += b[p];
      b[p] = 0;
    }
  }
  void pushUp(int l, int r, int p) { a[p] = a[p * 2] + a[p * 2 + 1]; }
  void update(int L, int R, T val) {
    if (L > R) return;
    update(1, n, 1, L, R, val);
  }
  void update(int l, int r, int p, int L, int R, T val) {
    if (l >= L && r <= R) {
      a[p] += val * (r - l + 1);
      b[p] += val;
      return;
    }
    pushDown(l, r, p);
    int m = (l + r) / 2;
    if (m >= L) update(l, m, p * 2, L, R, val);
    if (m + 1 <= R) update(m + 1, r, p * 2 + 1, L, R, val);
    pushUp(l, r, p);
  }
  T query(int L, int R) {
    if (L > R) return 0;
    return query(1, n, 1, L, R);
  }
  T query(int l, int r, int p, int L, int R) {
    if (l >= L && r <= R) {
      return a[p];
    }
    pushDown(l, r, p);
    int m = (l + r) / 2;
    T ret = 0;
    if (m >= L) ret += query(l, m, p * 2, L, R);
    if (m + 1 <= R) ret += query(m + 1, r, p * 2 + 1, L, R);
    return ret;
  }
};
vector<int> exkmp(const string& s, const string& t) {
  string v = s + "$" + t;
  vector<int> z(v.size());
  z[0] = v.size();
  int j = 1, k;
  for (int i = 1; i < v.size(); i = k) {
    if (j < i) j = i;
    while (j < v.size() && v[j] == v[j - i]) j++;
    z[i] = j - i;
    k = i + 1;
    while (k + z[k - i] < j) z[k] = z[k - i], k++;
  }
  return {z.begin() + s.size() + 1, z.end()};
}
int main() {
  std::ios_base::sync_with_stdio(false);
  int n, m;
  string s, t, h;
  cin >> n >> m >> s >> t >> h;
  auto lcp1 = exkmp(h, s);
  reverse(h.begin(), h.end());
  reverse(t.begin(), t.end());
  auto lcp2 = exkmp(h, t);
  reverse(lcp2.begin(), lcp2.end());
  SegmentTree<long long> st(n + 1);
  long long ans = 0;
  int p = n;
  for (int i = n; i >= 1; i--) {
    st.update(1, lcp2[i - 1], 1);
    if (i + m - 1 == p) {
      st.update(1, lcp2[--p], -1);
    }
    if (lcp1[i - 1] > 0) {
      ans += st.query(max(m - lcp1[i - 1], 1), min(m - 1, n));
    }
  }
  cout << ans << endl;
  return 0;
}
