The city where Vasya lives has a park with nn lawns connected by mm paths. One can walk in both directions along each path. The lawns connected by the path are called neighbors.
The entrance to the park is near the lawn number one which will be called the entrance lawn. Vasya’s parents are very concerned about his safety, so they allow him to play only on the lawn that is a neighbor to the entrance lawn. Entrance lawn is usually overcrowded, so Vasya can’t play on it.
Vasya finds it boring to simply walk along the path to the neighbor lawn. Instead, he starts at the entrance lawn, and walks along exactly three different paths. After that he plays on the lawn where he ends his walk. Vasya does not break the rules set by the parents, so he always ends his walk on the lawn neighboring to the entrance lawn.
Every day Vasya wants to choose a new walk he hasn’t taken before. Help him to determine how many ways are to begin his journey at the entrance lawn, follow exactly three different paths, and find himself on the lawn neighboring to the entrance lawn.
Input
The first line of input contains two integers nn and mm — the number of lawns and the number of paths, respectively (1≤n≤1000001≤n≤100000, 1≤m≤2000001≤m≤200000).
The next mm lines contain pairs of lawns connected by paths. Any two lawns are connected by no more than one path. There are no paths connecting a lawn to itself.
Output
Print the number of walks that Vasya can take.
Examples
Input
10 14
1 5
2 5
5 6
2 3
1 3
2 4
4 6
1 6
1 7
7 8
8 1
1 10
9 10
9 8
Output
4
Input
3 3
1 2
2 3
3 1
Output
0
#include <bits/stdc++.h>
using namespace std;
int n,m;
int sum;
int vis[100010];
int dis[100010];
vector<int>a[100010];
void dfs(int x,int cnt)
{
vis[x]=1;
if(cnt==3)
{
if(dis[x]==1)
sum++;
return;
}
int len=a[x].size();
for(int i=0; i<len; i++)
{
if(!vis[a[x][i]])
{
cnt++;
dfs(a[x][i],cnt);
cnt--;
vis[a[x][i]]=0;
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin>>n>>m;
while(m--)
{
int u,v;
cin>>u>>v;
if(u==1)
dis[v]=1;
if(v==1)
dis[u]=1;
a[u].push_back(v);
a[v].push_back(u);
}
sum=0;
dfs(1,0);
cout<<sum<<endl;
return 0;
}