# Counting Directed Walks
## Problem Statement
You are given a directed graph with $n$ nodes, numbered from $1$ to $n$, and $m$ directed edges. You are also given two specific nodes, a source node $s$ and a target node $t$.
Your task is to compute the number of distinct directed walks from node $s$ to node $t$, modulo $1,000,000,007$. If there are infinitely many such walks, you should print `INFINITE`.
A **walk** is a sequence of nodes $v_0, v_1, \dots, v_k$ such that there is a directed edge from $v_{i-1}$ to $v_i$ for all $1 \le i \le k$. Walks may revisit nodes and edges (i.e., cycles are allowed). The length of a walk is the number of edges it contains.
A **length-0 walk** from $s$ to $t$ exists if and only if $s = t$. In this case, it counts as one distinct walk, unless the total number of walks is infinite.
There are infinitely many walks from $s$ to $t$ if and only if there exists a directed cycle $C$ such that:
1. Cycle $C$ is reachable from $s$.
2. Node $t$ is reachable from any node in cycle $C$.
Formally, there must exist a walk $s \leadsto u$, a walk $u \leadsto u$ (forming a cycle), and a walk $u \leadsto t$ for some node $u$ that is part of a cycle.
## Input Format
The first line contains two integers $n$ and $m$ ($1 \le n \le 2 \cdot 10^5$, $0 \le m \le 2 \cdot 10^5$), representing the number of nodes and edges, respectively.
The next $m$ lines each contain two integers $u_i$ and $v_i$ ($1 \le u_i, v_i \le n$), representing a directed edge from node $u_i$ to node $v_i$.
The last line contains two integers $s$ and $t$ ($1 \le s, t \le n$), the source and target nodes.
## Output Format
Print the number of distinct directed walks from $s$ to $t$ modulo $1,000,000,007$. If there are infinitely many walks, print `INFINITE`.
## Sample Test Cases
### Sample Input 1
```
7 11
1 2
1 3
2 4
2 5
2 6
3 4
3 5
3 6
4 7
5 7
6 7
1 7
```
### Sample Output 1
```
6
```
## Constraints
- $1 \le n \le 2 \cdot 10^5$
- $0 \le m \le 2 \cdot 10^5$
- $1 \le u_i, v_i \le n$
- $1 \le s, t \le n$
- Multiple edges and self-loops are allowed.
- Time limit: 1 second
- Memory limit: 256 MB
## Explanation
The given graph is a directed acyclic graph (DAG). From node $1$, there are two choices to reach nodes $2$ or $3$. From nodes $2$ or $3$, there are three choices to reach nodes $4, 5,$ or $6$. Finally, from nodes $4, 5,$ or $6$, there is one choice to reach node $7$. Since all paths are independent and there are no cycles, the total number of distinct walks (which are paths in this DAG) is $2 \times 3 = 6$. There are no cycles reachable from $s$ that can also reach $t$, so the answer is finite.
Loading problem statement...