# your code goes here
from itertools import product
from fractions import Fraction
x = sum(a ^ b ^ c == 0 for a, b, c in product(range(1, 7), repeat=3))
print(x, 216 - x)
print(Fraction(216 - x, x))
x = sum(a ^ b ^ c == 1 for a, b, c in product(range(1, 7), repeat=3))
print(x, 216 - x)
print(Fraction(216 - x, x))
def f(x):
return 6 - abs(x - 7)
x = sum(f(a) * f(b) * f(c) for a, b, c in product(range(1, 13), repeat=3) if a ^ b ^ c == 0)
print(x, 6 ** 6 - x)
print(Fraction(6 ** 6 - x, x))
IyB5b3VyIGNvZGUgZ29lcyBoZXJlCgpmcm9tIGl0ZXJ0b29scyBpbXBvcnQgcHJvZHVjdApmcm9tIGZyYWN0aW9ucyBpbXBvcnQgRnJhY3Rpb24KCnggPSBzdW0oYSBeIGIgXiBjID09IDAgZm9yIGEsIGIsIGMgaW4gcHJvZHVjdChyYW5nZSgxLCA3KSwgcmVwZWF0PTMpKQoKcHJpbnQoeCwgMjE2IC0geCkKcHJpbnQoRnJhY3Rpb24oMjE2IC0geCwgeCkpCgp4ID0gc3VtKGEgXiBiIF4gYyA9PSAxIGZvciBhLCBiLCBjIGluIHByb2R1Y3QocmFuZ2UoMSwgNyksIHJlcGVhdD0zKSkKCnByaW50KHgsIDIxNiAtIHgpCnByaW50KEZyYWN0aW9uKDIxNiAtIHgsIHgpKQoKZGVmIGYoeCk6CglyZXR1cm4gNiAtIGFicyh4IC0gNykKCnggPSBzdW0oZihhKSAqIGYoYikgKiBmKGMpIGZvciBhLCBiLCBjIGluIHByb2R1Y3QocmFuZ2UoMSwgMTMpLCByZXBlYXQ9MykgaWYgYSBeIGIgXiBjID09IDApCnByaW50KHgsIDYgKiogNiAtIHgpCnByaW50KEZyYWN0aW9uKDYgKiogNiAtIHgsIHgpKQoJCQ==