#P6985. Calculus

    ID: 5842 远端评测题 2000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2021“MINIEYE杯”中国大学生算法设计超级联赛(4)

Calculus

Problem Description

This summer, ZXyang became so tired when doing the problems of Multi-University contests. So he decided to attend the Unified National Graduate Entrance Examination. This day, he sees a problem of series.

Let $S(x)$ be a function with $x$ as the independent variable. $S(x)$ can be represented by the formula as follow.

$$f(x)=\sum_{i=1}^n f_i(x)$$

$$S(x)=\sum_{j=1}^xf(j)$$

$f_i(x)$ is a function with $x$ as the independent variable. Furthermore. $f_i(x)$ belongs to the function set $F$.

$$
F=\left \{
C,
\frac{C}{x},
C\sin x,
C\cos x,
\frac{C}{\sin x},
\frac{C}{\cos x},
Cx,
C^x
\right \}
$$

$C$ is a constant integer ranging from $0$ to $10^9$.

ZXyang wonders if $S(x)$ is convergent. $S(x)$ is convergent if and only if $ \lim\limits_{x\to \infty}S(x)=c$, where $c$ is a constant.

Input

The first line of input contains a single integer $t\ (1\leq t\leq 10^4)$ --- the number of test cases.

The first and the only line of each test case contains a single string $s\ (1\leq |s|\leq 100)$, indicating the formula of $f(x)$. Fraction is presented as $\text{a/b}$. $C^x$ is presented as $\text{C^x}$. It's guaranteed that the constant $C$ won't be left out when $C=1$. $f(x)$ consists of functions from $F$ connected with $+$.

Output

For each test case, print $\text{YES}$ in one line if $S(x)$ is a convergent sequence, or print $\text{NO}$ in one line if not.

2 1sinx+0cosx+3x+6/sinx 0
NO YES