5366: Calculus

内存限制:256 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:3 解决:3

题目描述

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=0}^n$fi(x)
S(x)=$\sum_{j=0}^x$f(j)
fi(x) is a function with x as the independent variable. Furthermore. fi(x) belongs to the function set F.

F={C, $\frac{C}{x}$ ,Csinx,Ccosx, C/$\sin x$ ,C/$\cos x$ ,Cx,Cx}

C is a constant integer ranging from 0 to 109.

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

输入

The first line of input contains a single integer t (1≤t≤104) --- the number of test cases.

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

输出

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

样例输入 复制

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

样例输出 复制

NO
YES