-106. Divisible

I'm a slow walker, but I never walk backwards.

題目來源:judgegirl from ntu prof. pangfeng Liu

Task Description

Write a program to determine if a number is divisible by , and . The rules are as follow.

  • A number is divisible by if the last digit is divisible by .
  • A number is divisible by if the sum of the digits is divisible by .
  • A number is divisible by if the last digit is or .
  • A number is divisible by if the difference between the sum of the even positioned digits and the the sum of the odd positioned digits is divisible by .

For example the number is not divisible by because is not divisible by . It is not divisible by because is not divisible by . It is not divisible by because the last digit is . It is divisible by because the sum of even positioned digits is , and the the sum of odd positioned digits is . The difference between and is , which is divisible by .

Limits

The number of digits in a number is no more than . Note that the number of digits could be very large so you cannot store the number in an int.

Input

The input has several lines. Each line has a positive integer. A -1 indicates the end of input.

Output

For each input number your program should output four yes or no, which are separated by a space character. These yes and no indicate whether the input number is divisible by , and .

Sample input

190949
20
-1

Sample output

no no no yes
yes no yes no

Submit

Login

Testdata Set

Download Testdata