PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000028. Số nhị phân dưới đại dương (Ocean Deep! - Make it shallow!!)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số nhị phân dưới đại dương (Ocean Deep! - Make it shallow!!)

Ocean Deep! - Make it shallow!!

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

A nonnegative integer is written in binary with possibly many bits. The bits may span multiple lines and end with a # delimiter, which is not part of the number. Determine whether its value is divisible by the prime 131071131071.

Input

One or more lines of binary digits 0,1 terminated by a single #.

Output

Print YES if divisible, otherwise NO.

Subtasks

  • Subtask 1 (20 points): 1≤L≤201 \le L \le 20
  • Subtask 2 (30 points): 1≤L≤10001 \le L \le 1000
  • Subtask 3 (50 points): 1≤L≤100001 \le L \le 10000; Only bits 0 and 1 appear before #.

Examples

Input

1010101#

Output

NO

Explanation

Binary 1010101 equals decimal 8585, which is not divisible by 131071131071.