Konrad is a Human Relations consultant working for VoltModder, a large electrical equipment producer. Today, he has been tasked with evaluating the level of happiness in the company.

There are n people working for VoltModder, numbered from 1 to n. Each employee earns a different amount of money in the company — initially, the i-th person earns i rubles per day.

On each of q following days, the salaries will be revised. At the end of the i-th day, employee v_i will start earning n+i rubles per day and will become the best-paid person in the company. The employee will keep his new salary until it gets revised again.

Some pairs of people don't like each other. This creates a great psychological danger in the company. Formally, if two people a and b dislike each other and a earns more money than b, employee a will brag about this to b. A dangerous triple is a triple of three employees a, b and c, such that a brags to b, who in turn brags to c. If a dislikes b, then b dislikes a.

At the beginning of each day, Konrad needs to evaluate the number of dangerous triples in the company. Can you help him do it?

Input

The first line contains two integers n and m (1 ≤ n ≤ 100 000, 0 ≤ m ≤ 100 000) — the number of employees in the company and the number of pairs of people who don't like each other. Each of the following m lines contains two integers a_i, b_i (1 ≤ a_i, b_i ≤ n, a_i ≠ b_i) denoting that employees a_i and b_i hate each other (that is, a_i dislikes b_i and b_i dislikes a_i). Each such relationship will be mentioned exactly once.

The next line contains an integer q (0 ≤ q ≤ 100 000) — the number of salary revisions. The i-th of the following q lines contains a single integer v_i (1 ≤ v_i ≤ n) denoting that at the end of the i-th day, employee v_i will earn the most.

Output

Output q + 1 integers. The i-th of them should contain the number of dangerous triples in the company at the beginning of the i-th day.

Examples

Input


4 5
1 2
2 4
1 3
3 4
2 3
2
2
3


Output


4
3
2


Input


3 3
1 2
2 3
1 3
5
1
2
2
1
3


Output


1
1
1
1
1
1

Note

Consider the first sample test. The i-th row in the following image shows the structure of the company at the beginning of the i-th day. A directed edge from a to b denotes that employee a brags to employee b. The dangerous triples are marked by highlighted edges.

<image>
#include <bits/stdc++.h>
using namespace std;
long long arr[100005];
vector<long long> G[100005];
long long deg[100005];
long long cnt[100005];
vector<long long> gtrs[100005];
inline long long cal(long long u) {
  return deg[u] > 320
             ? (deg[u] - (long long)gtrs[u].size()) * (long long)gtrs[u].size()
             : (deg[u] - cnt[u]) * cnt[u];
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1, u, v; i <= m; i++) {
    cin >> u >> v;
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  iota(arr + 1, arr + 1 + n, 1);
  long long ans = 0;
  for (long long u = 1; u <= n; u++) {
    deg[u] = (long long)G[u].size();
    if (deg[u] > 320) {
      for (long long v : G[u])
        if (arr[v] > arr[u]) gtrs[u].emplace_back(v);
    } else {
      for (long long v : G[u])
        if (arr[v] > arr[u]) cnt[u]++;
    }
    ans += cal(u);
  }
  cout << ans << '\n';
  long long q;
  cin >> q;
  for (long long t = 1; t <= q; t++) {
    long long u;
    cin >> u;
    ans -= cal(u);
    vector<long long>& tem = (deg[u] > 320 ? gtrs[u] : G[u]);
    for (long long v : tem)
      if (arr[u] < arr[v]) {
        ans -= cal(v);
        if (deg[v] > 320)
          gtrs[v].emplace_back(u);
        else
          cnt[v]++;
        ans += cal(v);
      }
    if (deg[u] > 320)
      gtrs[u].clear();
    else
      cnt[u] = 0;
    arr[u] = n + t;
    cout << ans << '\n';
  }
  return 0;
}
