//Tanuj Khattar
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> II;
typedef vector< II > VII;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef long long int LL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
const int N = int(1e5)+10;
const int M = int(2e5)+10;
int U[M],V[M],isBridge[M],arr[N],T,cmpno;
int far[N],vis[N],level[N],par[N],root;
VI g[N],tree[N],ans;
queue<int> Q[N];
int adj(int u,int e)
{
return U[e]==u?V[e]:U[e];
}
int dfs0(int u,int ee)
{
vis[u]=1;int dbe=arr[u]=T++;
for(auto e:g[u])
{
int w = adj(u,e);
if(!vis[w])dbe=min(dbe,dfs0(w,e));
else if(e!=ee)dbe=min(dbe,arr[w]);
}
if(dbe==arr[u] && ee!=-1)isBridge[ee]=1;
return dbe;
}
void dfs1(int v)
{
vis[v]=1;
int currcmp = cmpno;
Q[currcmp].push(v);
while(!Q[currcmp].empty())
{
int u = Q[currcmp].front();
Q[currcmp].pop();
for(auto e:g[u])
{
int w = adj(u,e);
if(vis[w])continue;
if(isBridge[e])
{
cmpno++;
tree[cmpno].PB(currcmp);
tree[currcmp].PB(cmpno);
dfs1(w);
}
else
{
Q[currcmp].push(w);
vis[w]=1;
}
}
}
}
void buildBridgeTree()
{
SET(vis,0);
dfs0(1,-1);
SET(vis,0);
dfs1(1);
}
void dfs2(int u,int p)
{
far[u]=u;par[u]=p;
level[u]=level[p]+1;
for(auto w :tree[u])
if(w!=p)
{
dfs2(w,u);
if(level[far[w]]>level[far[u]])
far[u]=far[w];
}
}
int getCenter()
{
level[0]=-1;
dfs2(0,0);
int x = far[0];
level[x]=-1;
dfs2(x,x);
int y = far[x];
while(level[y]>level[far[x]]/2)y=par[y];
level[y]=-1;
dfs2(y,y);
return y;
}
void dfs(int u,int p,int len)
{
bool isLeaf=true;
for(auto w:tree[u])
{
if(w==p)continue;
isLeaf=false;
if(far[u]==far[w])dfs(w,u,len+1);
else dfs(w,u,1);
}
if(isLeaf)ans.PB(len);
}
int main()
{
int n,m,q;
si(n);si(m);si(q);
for(int i=0;i<m;i++)
{
scanf("%d %d",U+i,V+i);
g[U[i]].PB(i);
g[V[i]].PB(i);
}
buildBridgeTree();
root = getCenter();
dfs(root,root,0);
sort(ALL(ans));reverse(ALL(ans));
for(int i=1;i<SZ(ans);i++)ans[i]+=ans[i-1];
while(q--)
{
int k;si(k);k = 2*k;
k = min(k,SZ(ans));
dout(ans[k-1]);
}
return 0;
}
Ly9UYW51aiBLaGF0dGFyCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBwYWlyPGludCxpbnQ+ICAgSUk7CnR5cGVkZWYgdmVjdG9yPCBJSSA+ICAgICAgVklJOwp0eXBlZGVmIHZlY3RvcjxpbnQ+ICAgICBWSTsKdHlwZWRlZiB2ZWN0b3I8IFZJID4gCVZWSTsKdHlwZWRlZiBsb25nIGxvbmcgaW50IAlMTDsKCiNkZWZpbmUgUEIgcHVzaF9iYWNrCiNkZWZpbmUgTVAgbWFrZV9wYWlyCiNkZWZpbmUgRiBmaXJzdAojZGVmaW5lIFMgc2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