#include #include #define ft first #define sc second #define pt(sth) cout << sth << "\n" #define chmax(a, b) (a)=max(a, b) #define chmin(a, b) (a)=min(a, b) #define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD using namespace std; typedef long long ll; typedef pair pll; static const ll INF=1e18; static const ll MAX=101010; static const ll MOD=1e9+7; /* for(i=0; i> a[i]; */ ll N, M; vector g[MAX]; ll a[MAX]; ll mem[MAX]; ll dfs(ll u) { if(a[u]==3) return 1; if(mem[u]!=-1) return mem[u]; ll res=0; for(auto v:g[u]) if(a[u]+1==a[v]) { moC(res, +, dfs(v)); } return mem[u]=res; } int main(void) { ll i, j, k; cin >> N >> M; string s; cin >> s; for(i=0; i> u >> v; u--; v--; g[u].push_back(v); g[v].push_back(u); } memset(mem, -1, sizeof(mem)); ll ans=0; for(i=0; i