P12085 [AOJ] Help the Princess!
普及
题目描述

Example

Input

2 4
%.@\$
..$\$

Output

Yes

输入格式

见题面

输出格式

见题面

样例输入
2 4 %.@\$ ..\$\$
样例输出
Yes