Wet Shark once had 2 sequences: 
{a_n}= {a_1, a_2, a_3, ... , a_(109)}  
{b_n} = {b_1, b_2, b_3, ... , b_(109)}  
However, he only kept one element from each sequence. Luckily, both the elements that Wet Shark kept have the same index in Wet Shark's sequences: that is, he took a_i and b_i for some 1 ≤ i ≤ 109. 
Right after Wet Shark loses his sequences, he finds that he actually needs them to break the code of Cthulhu to escape a labyrinth. Cthulhu's code is a single floating point number Q. However, the code verifier is faulty. If Wet Shark enters any code c such that |c - Q| ≤ 0.01 , Cthulhu's code checker will allow him to escape.
Wet Shark now starts to panic, and consults Dry Dolphin for help via ultrasonic waves. After the Dry Dolphin Sequence Processing Factory processes data of Wet Shark's sequences, the machines give Wet Shark the following 2 relations his sequences follow for all 1 ≤ n < 109, where x = sqrt(2) and y = sqrt(3).
Wet Shark is now clueless on how to compute anything, and asks you for help.
Wet Shark has discovered that Cthulhu's code is actually defined as Q = (a_k + b_k) / (2^s), where s is a predetermined number, k is the index of another element in Wet Shark's sequence, and a_k, b_k are precisely the kth elements of Wet Shark's sequences {a_n} and {b_n}, respectively.
Given k, i, and the 2 elements of the arrays Wet Shark has lost, find any value of the code c that will allow Wet Shark to exit Cthulhu's labyrinth.
-----Input-----
The first line of input contains 3 space separated integers i, k, s — the common index of the two elements Wet Shark kept, the index of Wet Shark's array needed to break Cthulhu's code, and the number s described in the problem statement, respectively. It is guaranteed that Cthulhu's code, Q, is between -109 and 109 (both inclusive).
The second line of the input contains 2 space separated integers a_i and b_i, representing the ith element of sequence {a_n} and the ith element of sequence {b_n}, respectively.
-----Output-----
Output any number c that will crack Cthulhu's code. Recall that if Wet Shark enters any code c such that |c - Q| ≤ 0.01 , Cthulhu's code checker will allow him to exit the labyrinth.
----- Constraints -----
-   SUBTASK 1: 20 POINTS  
-  1 ≤ i ≤ 103 
-  1 ≤ k ≤ 103 
-  -103 ≤ s ≤ 103 
-  1 ≤ a_i, b_i ≤ 103 
-   SUBTASK 2: 80 POINTS  
-  1 ≤ i ≤ 1010 
-  1 ≤ k ≤ 1010 
-  -1010 ≤ s ≤ 1010 
-  1 ≤ a_i, b_i ≤ 1010 
It is guaranteed that -1010 ≤ Q ≤  1010.
-----Example-----
Input:
1 1 5
4 5
Output:
0.28125
-----Explanation-----
Example case 1. In this case, a_1 = 4, b_1 = 5, and s = 5. Cthulhu's code in this case is (a_1 + b_1) / (2s) = 9/32 = 0.28125.
import math

def main():
  #print("enter i, k, s")
  IN = '11 6 5'
  z = IN.split()
  z = input().split()
  i = int(z[0])
  k = int(z[1])
  s = int(z[2])

  #print("enter a_i and b_i")
  IN = '4 5'
  z = IN.split()
  z = input().split()
  a_i = int(z[0])
  b_i = int(z[1])

  #print( "i = %d   k = %d   s = %d " % (i, k, s)  )
  #print( "a_i = %d   b_i = %d" % (a_i, b_i)  )

  x = math.sqrt(2)
  y = math.sqrt(3)
  #print(x,y)

  # Obtaining the k-th element when k >= i
  if(i<=k):
    diff = k-i
    #if both k and i are odd or even
    if(k-i)%2==0:
      #print("#1")
      ans =  (a_i + b_i) * math.pow(2,2*(k-i)-s)
      #diff = int(diff/2) 
      #ans =  (a_i + b_i) * math.pow(2,4*diff-s)
          
    #if i and k are of different parities then obtaining first
    # a_(i+1) and b_(i+1)
    else:
      #print("#2")
      ans = (2*x*a_i + 2*x*y*b_i) * math.pow(2,2*(k-(i+1))-s )
      diff = int(diff/2)
      ans = (2*x*a_i + 2*x*y*b_i) * math.pow(2,4*diff - s)
      #print("1: ", (2*x*a_i + 2*x*y*b_i))
      #print("2: ", math.pow(2,4*diff - 2- s))  
      #print("2 sol: ", math.pow(2,4*int(diff)-s))
      #print("diff: ",diff)


  # Obtaining the k_th element when k < i
  else:
    diff = i-k
    #if both k and i are odd or even
    if(i-k)%2==0:
      #print("#3")
      ans =  (a_i + b_i) / math.pow(2,2*(i-k)+s)
      #diff =  int(diff/2)
      #ans =  (a_i + b_i) / math.pow(2,4*diff+s)

    #if i and k are of different parities then obtaining first
    # a_(i+1) and b_(i+1)
    else:
      #print("#4")
      ans = (2*x*a_i + 2*x*y*b_i) / math.pow(2,2*(i+1-k)+s)
      diff = int(diff/2)
      ans = (2*x*a_i + 2*x*y*b_i) / math.pow(2,4*diff + 4 + s)


  print(ans)
  
main()

import math

def main():
  #print("enter i, k, s")
  IN = '11 6 5'
  z = IN.split()
  z = input().split()
  i = int(z[0])
  k = int(z[1])
  s = int(z[2])

  #print("enter a_i and b_i")
  IN = '4 5'
  z = IN.split()
  z = input().split()
  a_i = int(z[0])
  b_i = int(z[1])

  #print( "i = %d   k = %d   s = %d " % (i, k, s)  )
  #print( "a_i = %d   b_i = %d" % (a_i, b_i)  )

  x = math.sqrt(2)
  y = math.sqrt(3)
  #print(x,y)

  # Obtaining the k-th element when k >= i
  if(i<=k):
    diff = k-i
    #if both k and i are odd or even
    if(k-i)%2==0:
      #print("#1")
      ans =  (a_i + b_i) * math.pow(2,2*(k-i)-s)
      #diff = int(diff/2) 
      #ans =  (a_i + b_i) * math.pow(2,4*diff-s)
          
    #if i and k are of different parities then obtaining first
    # a_(i+1) and b_(i+1)
    else:
      #print("#2")
      ans = (2*x*a_i + 2*x*y*b_i) * math.pow(2,2*(k-(i+1))-s )
      diff = int(diff/2)
      ans = (2*x*a_i + 2*x*y*b_i) * math.pow(2,4*diff - s)
      #print("1: ", (2*x*a_i + 2*x*y*b_i))
      #print("2: ", math.pow(2,4*diff - 2- s))  
      #print("2 sol: ", math.pow(2,4*int(diff)-s))
      #print("diff: ",diff)


  # Obtaining the k_th element when k < i
  else:
    diff = i-k
    #if both k and i are odd or even
    if(i-k)%2==0:
      #print("#3")
      ans =  (a_i + b_i) / math.pow(2,2*(i-k)+s)
      #diff =  int(diff/2)
      #ans =  (a_i + b_i) / math.pow(2,4*diff+s)

    #if i and k are of different parities then obtaining first
    # a_(i+1) and b_(i+1)
    else:
      #print("#4")
      ans = (2*x*a_i + 2*x*y*b_i) / math.pow(2,2*(i+1-k)+s)
      diff = int(diff/2)
      ans = (2*x*a_i + 2*x*y*b_i) / math.pow(2,4*diff + 4 + s)


  print(ans)
  
main()
