#
# OUR SOLUTION
#

# initial case
# We assume that the probability of getting head is 1 at the beginning,
#    because Asja will start with one euro.
prob_head = 1
prob_tail = 0


#
# first coin-flip
#

# if the last result was head
new_prob_head_from_head = prob_head * 0.6
new_prob_tail_from_head = prob_head * 0.4

# if the last result was tail
# we know that prob_tail is 0 at the beginning 
#     but we still keep these two lines to have the same code for each iteration
new_prob_head_from_tail = prob_tail * 0.3
new_prob_tail_from_tail = prob_tail * 0.7

# update the probabilities at the end of coin toss
prob_head = new_prob_head_from_head + new_prob_head_from_tail
prob_tail = new_prob_tail_from_head + new_prob_tail_from_tail

#
# second coin-flip
#
# we do the same calculations

new_prob_head_from_head = prob_head * 0.6
new_prob_tail_from_head = prob_head * 0.4

new_prob_head_from_tail = prob_tail * 0.3
new_prob_tail_from_tail = prob_tail * 0.7

prob_head = new_prob_head_from_head + new_prob_head_from_tail
prob_tail = new_prob_tail_from_head + new_prob_tail_from_tail

#
# third coin-flip
#
# we do the same calculations

new_prob_head_from_head = prob_head * 0.6
new_prob_tail_from_head = prob_head * 0.4

new_prob_head_from_tail = prob_tail * 0.3
new_prob_tail_from_tail = prob_tail * 0.7

prob_head = new_prob_head_from_head + new_prob_head_from_tail
prob_tail = new_prob_tail_from_head + new_prob_tail_from_tail

# print prob_head and prob_tail
print("the probability of getting head",prob_head)
print("the probability of getting tail",prob_tail)


#
# your solution is here
#
