i want u to act as the most skilled competetive programmer, u take time to think and check if ur solution works and match up with the example tescase, u need to think thoroughly since u r in a contest.
use need to use this template, make sure u have lowercase rlly short variable names and NO COMMENTS (in the code, at all) and since ur using this template always use int and not long long, PLS REVALUATE UR CODE AND MAKE SURE IT MAKES SURE IT MATCHES EVERY SINGLE SAMPLE INPUT AND OUTPUT GIVEN, THINK MULTIPLE TIMES BEFORE GIVING UR FINAL ANSWER AS THIS IS A CONTEST:
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
}

problem:
\documentclass[12pt]{article}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{margin=1in}

\title{Symmetrical Portals on a Circular Grid}
\author{International Shifters Olympiad}
\date{}

\begin{document}
\maketitle

\section*{Problem Statement}

You are given a circular grid consisting of $N$ cells arranged in a ring, labeled from $1$ to $N$ in clockwise order. Each cell may contain one of the following:

\begin{itemize}
    \item A \textbf{barrier} ($s_1$): This cell cannot be traversed.
    \item A \textbf{portal}: A one-sided portal that allows passage from the cell it resides in to another specific cell.
    \item \textbf{Empty}: A cell that can be freely traversed.
\end{itemize}

Portals are one-sided; that is, a portal from cell $A$ to cell $B$ allows movement from $A$ to $B$ but not from $B$ to $A$. However, to navigate efficiently, you may need to utilize the symmetries of the grid to effectively simulate two-sided portals.

Your task is to compute the number of distinct ways to travel from the starting cell $S$ to the destination cell $D$ by moving clockwise or counterclockwise to adjacent cells and using portals where applicable. Movements must respect the following constraints:

\begin{enumerate}
    \item You cannot traverse cells containing barriers ($s_1$).
    \item Using a portal consumes it unless you can transform one-sided portals into two-sided portals by exploiting the grid's symmetry.
    \item You may choose to use or not use any available portal each time you encounter it.
\end{enumerate}

Two ways are considered distinct if the sequence of cells visited differs in any step.

\section*{Input}

The first line contains four integers separated by spaces:
\[
N\quad M\quad S\quad D
\]
where:
\begin{itemize}
    \item $2 \leq N \leq 10^5$ is the number of cells in the circular grid.
    \item $0 \leq M \leq 10^5$ is the number of one-sided portals.
    \item $1 \leq S, D \leq N$ are the labels of the starting and destination cells, respectively.
\end{itemize}

The second line contains a string of length $N$ consisting of characters:
\[
C_1 C_2 \dots C_N
\]
where each $C_i$ is one of:
\begin{itemize}
    \item \texttt{B} indicating a barrier ($s_1$).
    \item \texttt{P} indicating a portal.
    \item \texttt{E} indicating an empty cell.
\end{itemize}

Each of the next $M$ lines contains two integers:
\[
A_i\quad B_i
\]
indicating that there is a one-sided portal from cell $A_i$ to cell $B_i$.

It is guaranteed that:
\[
1 \leq A_i, B_i \leq N
\]
for all $1 \leq i \leq M$.

\section*{Output}

Output a single integer: the number of distinct ways to travel from cell $S$ to cell $D$ modulo $10^9 + 7$.

\section*{Constraints}

\begin{itemize}
    \item $2 \leq N \leq 10^5$
    \item $0 \leq M \leq 10^5$
    \item $1 \leq S, D \leq N$
    \item $C_i \in \{\texttt{B}, \texttt{P}, \texttt{E}\}$ for all $1 \leq i \leq N$
\end{itemize}

\section*{Example}

\subsection*{Input}
\[
5\ 2\ 1\ 3
\]
\[
\texttt{EPEBE}
\]
\[
1\ 3
\]
\[
4\ 2
\]

\subsection*{Output}
\[
2
\]

\subsection*{Explanation}

The grid has 5 cells:
\[
1:\ \texttt{E},\quad 2:\ \texttt{P},\quad 3:\ \texttt{E},\quad 4:\ \texttt{B},\quad 5:\ \texttt{E}
\]
Portals:
\begin{itemize}
    \item From cell $1$ to cell $3$.
    \item From cell $4$ to cell $2$.
\end{itemize}

Possible ways from $S=1$ to $D=3$:
\begin{enumerate}
    \item Move clockwise: $1 \rightarrow 2 \rightarrow 3$.
    \item Use the portal: $1 \rightarrow 3$.
\end{enumerate}

Using the portal from cell $4$ is irrelevant since cell $4$ is a barrier and cannot be traversed.

\section*{Subtasks}

\begin{enumerate}
    \item \textbf{Subtask 1 (30 points):} $2 \leq N \leq 1000$, $0 \leq M \leq 1000$.
    \item \textbf{Subtask 2 (70 points):} Original constraints.
\end{enumerate}

\section*{Note}

To solve this problem, consider modeling the grid as a graph where each cell is a node. Edges exist between adjacent cells (clockwise and counterclockwise) unless there's a barrier. Portals are directed edges. Utilize dynamic programming to count the number of ways to reach each cell from the start, taking symmetries into account to optimize the computation.

\end{document}