Codeforces Beta Round 91 (Div. 2 Only)


A. Lucky Division
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
47
Output
YES
Input
16
Output
YES
Input
78
Output
NO
----------------------------------------------------------------------------------------------------
B. Lucky Substring
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
047
Output
4
Input
16
Output
-1
Input
472747
Output
7
----------------------------------------------------------------------------------------------------
C. Lucky Sum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 7
Output
33
Input
7 7
Output
7
----------------------------------------------------------------------------------------------------
D. Lucky Transformation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 4
4727447
Output
4427477
Input
4 2
4478
Output
4478
----------------------------------------------------------------------------------------------------
E. Lucky Permutation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 4
Output
1
Input
4 7
Output
1
----------------------------------------------------------------------------------------------------
