#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
std::mt19937 rnd(
    std::chrono::high_resolution_clock::now().time_since_epoch().count());
const double PI = atan2(0.0, -1.0);
const int INF = 0x3f3f3f3f;
const ll LINF = (ll)2e18;
const int N = 500100;
class Event {
 public:
  int x, type, id;
  Event(int x, int type, int id) : x(x), type(type), id(id) {}
  bool operator<(const Event& other) const {
    return x < other.x || (x == other.x && type < other.type) ||
           (x == other.x && type == other.type &&
            (type == 1 ? id < other.id : id > other.id));
  }
};
class Fenwick {
 public:
  Fenwick() { reset(); }
  void reset() { memset(f, 0, sizeof(f)); }
  int get(int r) {
    int ans = 0;
    for (; r > 0; r -= r & -r) {
      ans += f[r];
    }
    return ans;
  }
  int get(int l, int r) { return get(r) - get(l - 1); }
  void upd(int pos, int add) {
    for (; pos < N; pos += pos & -pos) {
      f[pos] += add;
    }
  }

 private:
  int f[N];
};
std::vector<int> buildZ(const std::string& s) {
  int n = (int)s.size();
  std::vector<int> z(n);
  int l = 0, r = 1;
  for (int i = 1; i < n; ++i) {
    if (i < r) {
      z[i] = std::min(z[i - l], r - i);
    }
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) {
      ++z[i];
    }
    if (i + z[i] >= r) {
      l = i;
      r = i + z[i];
    }
  }
  return z;
}
void run() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  int n, m;
  std::cin >> n >> m;
  std::string a, b, s;
  std::cin >> a >> b >> s;
  std::vector<int> z1 = buildZ(s + "#" + a);
  std::reverse(s.begin(), s.end());
  std::reverse(b.begin(), b.end());
  std::vector<int> z2 = buildZ(s + "#" + b);
  std::vector<Event> q;
  for (int i = 0; i < n; ++i) {
    q.push_back(Event(z1[m + 1 + i] + 1, -1, i + 1));
    q.push_back(Event(m - std::min(m - 1, z2[m + 1 + n - i - 1]), 1, i + 1));
  }
  std::sort(q.begin(), q.end());
  Fenwick f1, f2;
  for (int i = 1; i <= n; ++i) {
    f1.upd(i, 1);
  }
  ll ans = 0, cur = 0;
  int ptr = 0;
  for (int pref = 1; pref < m; ++pref) {
    while (ptr < (int)q.size() && q[ptr].x == pref) {
      int id = q[ptr].id;
      if (q[ptr].type == 1) {
        f2.upd(id, 1);
        cur += f1.get(std::max(1, id - m + 2), id);
      } else {
        f1.upd(id, -1);
        cur -= f2.get(id, std::min(n, id + m - 2));
      }
      ++ptr;
    }
    ans += cur;
  }
  printf("%lld\n", ans);
}
int main(void) {
  auto start = std::chrono::high_resolution_clock::now();
  run();
  auto end = std::chrono::high_resolution_clock::now();
  return 0;
}
