- 6

## Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

## Statement

## Goal

You have to write a solver of a conditional probabilities exercise where`A`and

`B`are two events.

For readability, we will write that the probability of

`A`is

`A`.

You are given three probabilities, for example:

*

`A`,

`B`,

`A GIVEN B`

*

`NOT A`,

`A AND B`,

`B GIVEN NOT A`

*

`A`,

`NOT A GIVEN B`,

`B GIVEN A`

Where:

*

`NOT A`means the probability of the opposite of

`A`,

*

`A AND B`means the probability of the conjunction of

`A`and

`B`(ie

`A`and

`B`occur simultaneously),

*

`A GIVEN B`means the probability of

`A`if

`B`occurs.

For example, you have these relations:

`A`+

`NOT A`= 1

`A AND B`+

`A AND NOT B`=

`A`

`A AND NOT B`=

`A`×

`NOT B GIVEN A`=

`NOT B`×

`A GIVEN NOT B`

Note that

`A AND B`is

`B AND A`(so we will use only the first one) but that

`A GIVEN B`

**is not**

`B GIVEN A`(it’s a classical fallacy in psychology).

You have to find all the probabilities you can build with the words

`A`,

`B`,

`NOT`(unary operator),

`AND`and

`GIVEN`(binary operators). Write them in the lexicographic order:

`A`before

`A AND B`before

`A GIVEN B`before

`A GIVEN NOT B`but not

`B AND A`.

Input

`FIRST PROBABILITY`=

`SECOND PROBABILITY`=

`THIRD PROBABILITY`=

Output

16 sorted lines of the probabilities (written as reduced fractions) if the exercise is solvable, written as the input and including the input.

If the given data are not enough to solve the exercise, print only the probabilities that you can calculate (and that you are given).

If the given data are not enough to solve the exercise, print only the probabilities that you can calculate (and that you are given).

`IMPOSSIBLE`if the solution is a contradiction (for example if a probability is <0 or >1 or if a probability has actually two different values).Constraints

The probabilities are given as fractions of integers.

Example

Input

A = 1/2 B = 1/3 A AND B = 1/6

Output

A = 1/2 A AND B = 1/6 A AND NOT B = 1/3 A GIVEN B = 1/2 A GIVEN NOT B = 1/2 B = 1/3 B GIVEN A = 1/3 B GIVEN NOT A = 1/3 NOT A = 1/2 NOT A AND B = 1/6 NOT A AND NOT B = 1/3 NOT A GIVEN B = 1/2 NOT A GIVEN NOT B = 1/2 NOT B = 2/3 NOT B GIVEN A = 2/3 NOT B GIVEN NOT A = 2/3

A higher resolution is required to access the IDE