Codeforces Beta Round 84 (Div. 2 Only)


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

Examples
Input
40047
Output
NO
Input
7747774
Output
YES
Input
1000000000000000000
Output
NO
----------------------------------------------------------------------------------------------------
B. Lucky String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
Output
abcda
Input
3
Output
abc
----------------------------------------------------------------------------------------------------
C. Lucky Sum of Digits
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
Output
47
Input
10
Output
-1
----------------------------------------------------------------------------------------------------
D. Lucky Probability
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 10 1 10 2
Output
0.320000000000
Input
5 6 8 10 1
Output
1.000000000000
----------------------------------------------------------------------------------------------------
E. Lucky Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2 4
3 1 2
1 4 7
Output
16
Input
4
1 2 4
1 3 47
1 4 7447
Output
24
----------------------------------------------------------------------------------------------------
