# BZOJ2125 最短路

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#define N (30010)
#define M (400010)
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
#define spa print(' ')
#define ent print('\n')
#define rand() (((rand())<<(15))^(rand()))
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
static const int IN_LEN=1000000;
static char buf[IN_LEN],*s,*t;
}
template<class T>
static bool iosig;
static char c;
if(c=='-')iosig=true;
if(c==-1)return;
}
if(iosig)x=-x;
}
static char c;
if(c==-1)return 0;
return c;
}
const int OUT_LEN = 10000000;
char obuf[OUT_LEN],*ooh=obuf;
inline void print(char c) {
if(ooh==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
*ooh++=c;
}
template<class T>
inline void print(T x){
static int buf[30],cnt;
if(x==0)print('0');
else{
if(x<0)print('-'),x=-x;
for(cnt=0;x;x/=10)buf[++cnt]=x%10+48;
while(cnt)print((char)buf[cnt--]);
}
}
inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
vector<int> G[N],D[N]; bool ins[N];
int fi[N],b[M],ne[M],c[M],E,f[N][18],dis[N],fa[N],qq[N];
int n,m,Q,st[N],dfn[N],low[N],ind,top,cnt,dep[N],ab[N],cir[N];
ne[++E]=fi[x],fi[x]=E,b[E]=y,c[E]=z;
ne[++E]=fi[y],fi[y]=E,b[E]=x,c[E]=z;
}
void dfs(int u,int pre){
f[u][0]=pre;
for(int i=fi[u];i;i=ne[i])
if(b[i]!=pre){
int v=b[i];
dis[v]=dis[u]+c[i];
dep[v]=dep[u]+1,dfs(v,u);
}
}
void work(int u,int s,int d){
qq[u]=0,cir[++cnt]=d;
for(int i=u;i!=s;i=fa[i])
qq[fa[i]]=qq[i]+ab[i],cir[cnt]+=ab[i];
for(int i=u;i!=s;i=fa[i])
}
void tarjan(int u,int pre){
dfn[u]=low[u]=++ind;
ins[u]=1,fa[u]=pre;
for(int i=0;i<G[u].size();i++){
int v=G[u][i],L=D[u][i];
if(!dfn[v])ab[v]=L,tarjan(v,u),
low[u]=min(low[u],low[v]);
else if(v!=pre)low[u]=min(low[u],dfn[v]);
if(fa[v]!=u&&low[v]>=dfn[u])work(v,u,L);
}
}
void bz(){
for(int j=1;j<=16;j++)
for(int i=1;i<=cnt;i++)
f[i][j]=f[f[i][j-1]][j-1];
}
int lca(int x,int y){
if(dep[x]<dep[y])swap(x,y);
int k=dep[x]-dep[y];
for(int i=0;i<=16;i++)
if(k&(1<<i))x=f[x][i];
if(x==y)return x;
for(int i=16;~i;i--)
if(f[x][i]!=f[y][i])
x=f[x][i],y=f[y][i];
return (x==y)?x:f[x][0];
}
int findc(int x,int rt){
int k=dep[x]-dep[rt]-1;
for(int i=0;i<=16;i++)
if(k&(1<<i))x=f[x][i];
return x;
}
int getdis(int x,int y){
int rt=lca(x,y);
if(rt<=n)return dis[x]+dis[y]-2*dis[rt];
int tx=findc(x,rt),ty=findc(y,rt);
int len=dis[x]-dis[tx]+dis[y]-dis[ty];
int L=abs(qq[tx]-qq[ty]);
return len+min(L,cir[rt]-L);
}
int main(){
}