#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const long long BIG_INF = 1e18;
const long long MOD = 1e9 + 7;
struct node {
  node *next[26];
  long long cnt;
  node() {
    for (int i = 0; i < 26; i++) next[i] = nullptr;
    cnt = 0;
  }
};
const int maxn = 2 * 1e5 + 2;
long long all_cnt[maxn], sm_cnt[maxn];
node *root = new node();
string a[maxn], t;
int pi[2 * maxn];
void add(string s, int in) {
  node *x = root;
  for (int i = 0; i < (int)s.size(); i++) {
    int to = s[i] - 'a';
    if (x->next[to] == nullptr) x->next[to] = new node();
    x = x->next[to];
  }
  x->cnt++;
}
void update(int i, int type) {
  node *x = root;
  int start = i;
  while (i < (int)t.size()) {
    int to = t[i] - 'a';
    if (x->next[to] == nullptr) break;
    x = x->next[to];
    i++;
    if (type)
      all_cnt[start] += x->cnt;
    else
      sm_cnt[i - start] += x->cnt;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  int n;
  cin >> n;
  int lim = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    lim += (int)a[i].size();
  }
  lim = sqrt(lim);
  vector<int> big_in;
  for (int i = 0; i < n; i++) {
    if ((int)a[i].size() <= lim)
      add(a[i], i);
    else
      big_in.push_back(i);
  }
  for (int i = 0; i < (int)t.size(); i++) update(i, 1);
  for (int z = 0; z < (int)big_in.size(); z++) {
    int in = big_in[z];
    string s = a[in] + "#" + t;
    for (int i = 1; i < (int)s.size(); i++) {
      int j = pi[i - 1];
      while (j > 0 && s[i] != s[j]) j = pi[j - 1];
      if (s[i] == s[j]) j++;
      pi[i] = j;
    }
    for (int i = 0; i < (int)s.size(); i++)
      if (pi[i] == (int)a[in].size()) all_cnt[i - 2 * (int)a[in].size()]++;
  }
  long long ans = 0;
  for (int i = 0; i < (int)t.size(); i++) {
    for (int j = 0; j <= lim; j++) sm_cnt[j] = 0;
    update(i, 0);
    for (int j = 1; j <= lim && i + j < (int)t.size(); j++)
      ans += sm_cnt[j] * all_cnt[i + j];
  }
  for (int z = 0; z < (int)big_in.size(); z++) {
    int in = big_in[z];
    string s = a[in] + "#" + t;
    for (int i = 1; i < (int)s.size(); i++) {
      int j = pi[i - 1];
      while (j > 0 && s[i] != s[j]) j = pi[j - 1];
      if (s[i] == s[j]) j++;
      pi[i] = j;
    }
    for (int i = 0; i < (int)s.size(); i++)
      if (pi[i] == (int)a[in].size()) ans += all_cnt[i - (int)a[in].size()];
  }
  cout << ans << "\n";
  return 0;
}
