Problem:
﻿Score: 100 points

Problem Statement

In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.

Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.

Determine if there exists a pair of antennas that cannot communicate directly.

Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.

Constraints

a, b, c, d, e and k are integers between 0 and 123 (inclusive).

a < b < c < d < e

Input

Input is given from Standard Input in the following format:

a
b
c
d
e
k

Output

Print :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.

Sample Input 1

1
2
4
8
9
15

Sample Output 1

Yay!

In this case, there is no pair of antennas that cannot communicate directly, because:

the distance between A and B is 2 - 1 = 1

the distance between A and C is 4 - 1 = 3

the distance between A and D is 8 - 1 = 7

the distance between A and E is 9 - 1 = 8

the distance between B and C is 4 - 2 = 2

the distance between B and D is 8 - 2 = 6

the distance between B and E is 9 - 2 = 7

the distance between C and D is 8 - 4 = 4

the distance between C and E is 9 - 4 = 5

the distance between D and E is 9 - 8 = 1

and none of them is greater than 15. Thus, the correct output is Yay!.

Sample Input 2

15
18
26
35
36
18

Sample Output 2

:(

In this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.
Thus, the correct output is :(.

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

struct State {
    counts: [u64; 13],
    power: u64,
}

fn rec(st: State, c: char) -> State {
    let power = (st.power * 10) % 13;
    let range = if let Some(x) = c.to_digit(10) {
        x..(x + 1)
    } else {
        0..10
    };
    let mut counts = [0; 13];
    for i in range {
        let base = power * i as u64;
        for (j, &count) in st.counts.iter().enumerate() {
            let rem = ((base + j as u64) % 13) as usize;
            counts[rem] += count;
            counts[rem] %= 1_000_000_007;
        }
    }

    State {
        counts: counts,
        power: power,
    }
}

fn initialize(c: char) -> [u64; 13] {
    let mut a = [0; 13];
    if let Some(x) = c.to_digit(10) {
        a[x as usize] = 1;
    } else {
        for i in 0..10 {
            a[i] = 1;
        }
    }
    a
}

fn evaluate(v: Vec<char>) -> u64 {
    let init = State {
        counts: initialize(v[0]),
        power: 1,
    };
    v[1..].into_iter().fold(init, |st, &c| rec(st, c)).counts[5]
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let v: Vec<char> = iter.next().unwrap().chars().rev().collect();

    println!("{}", evaluate(v));
}