• 33

## Goal

The purpose of this puzzle is to find the result (profit) asked from 6 supplied figures. You have at your disposal the four standard operators: addition (bill), subtraction, multiplication (increase) and division.

Only subtractions resulting in a positive number are considered.
Only divisions resulting in an integer are considered.

Exemple 1 :
if input is
Result : 862
a : 7, b : 9, c : 100, d : 25, e : 3, f : 3

100 - 7 = 93
93 x 9 = 837
837 + 25 = 862

output would be
POSSIBLE
3

Exemple 2:
if input is
Result : 862
a : 3, b : 5, c : 6, d : 2, e : 1, f : 7

3 x 7 = 21
5 + 2 = 7
7 x 6 = 42
42 - 1 = 41
41 x 21 = 861

output would be
IMPOSSIBLE
1
Input
Line 1: 1 integer Result give u the result of operation
Line 2 : 6 integer (a, b, c, d, e, f) for number to make operation
Output
Line 1: POSSIBLE or IMPOSSIBLE. If the operation is possible or not
Line 2: min distance from result if the result is impossible to obtain or number of minimal count of operations if the operation is possible
Constraints
100 ≤ Resultat ≤ 999
a, b, c, d, e, f in (1,2,3,4,5,6,7,8,9,10,25,50,75,100)
Example
Input
101
100 5 2 3 4 1
Output
POSSIBLE
1

A higher resolution is required to access the IDE   Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
Online Participants