Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

a = int(raw_input())

while a	> 0:
    x1,y1,x2,y2,x3,y3 =	map(float,raw_input().split())

    a1 = 2*(x2-x1)
    b1 = 2*(y2-y1)
    c1 = x1*x1-x2*x2+y1*y1-y2*y2
    a2 = 2*(x3-x1)
    b2 = 2*(y3-y1)
    c2 = x1*x1-x3*x3+y1*y1-y3*y3

    X = (b1*c2-b2*c1)/(a1*b2-a2*b1)
    Y = (c1*a2-c2*a1)/(a1*b2-a2*b1)

    R = math.sqrt((X-x1)*(X-x1)+(Y-y1)*(Y-y1))

    print "%.3f %.3f %.3f" % (X,Y,R)

Fixed submission:
import math

a = int(raw_input())

while a	> 0:
    a -= 1
    x1,y1,x2,y2,x3,y3 =	map(float,raw_input().split())

    a1 = 2*(x2-x1)
    b1 = 2*(y2-y1)
    c1 = x1*x1-x2*x2+y1*y1-y2*y2
    a2 = 2*(x3-x1)
    b2 = 2*(y3-y1)
    c2 = x1*x1-x3*x3+y1*y1-y3*y3

    X = (b1*c2-b2*c1)/(a1*b2-a2*b1)
    Y = (c1*a2-c2*a1)/(a1*b2-a2*b1)

    R = math.sqrt((X-x1)*(X-x1)+(Y-y1)*(Y-y1))

    print "%.3f %.3f %.3f" % (X,Y,R)
Buggy python submission (verdict: Runtime Error):
import sys
import math
n = int(raw_input())

for i in range(n):
    dist = math.sqrt((yb - ya) **2 + (xb - xa) **2)
    if dist > (ra + rb):
        return 0
    elif abs(ra - rb) <= dist <= (ra + rb):
        return 1
    elif dist < abs(ra - rb):
	if ra > rb:
            return 2
        else:
            return -2

Fixed submission:
import sys
import math
N = int(sys.stdin.readline().strip())
 
def calc(xa, ya, ra, xb, yb, rb):
    dist = math.sqrt((yb - ya) **2 + (xb - xa) **2)
    if dist > (ra + rb):
        return 0
    elif abs(ra - rb) <= dist <= (ra + rb):
        return 1
    elif dist < abs(ra - rb):
        if ra > rb:
            return 2
        else:
            return -2
 
for i in xrange(N):
    line = sys.stdin.readline().strip()
    xa, ya, ra, xb, yb, rb = map(float, line.split())
    print calc(xa, ya, ra, xb, yb, rb)

Buggy python submission (verdict: Runtime Error):
import sys
import math
n = int(raw_input())

for i in range(n):
    xa,ya,ra,xb,ya,rb =	map(float,raw_input().split())
    dist = math.sqrt((yb - ya) **2 + (xb - xa) **2)
    if dist > (ra + rb):
        return 0
    elif abs(ra - rb) <= dist <= (ra + rb):
        return 1
    elif dist < abs(ra - rb):
	if ra > rb:
            return 2
        else:
            return -2

Fixed submission:
import sys
import math
N = int(sys.stdin.readline().strip())
 
def calc(xa, ya, ra, xb, yb, rb):
    dist = math.sqrt((yb - ya) **2 + (xb - xa) **2)
    if dist > (ra + rb):
        return 0
    elif abs(ra - rb) <= dist <= (ra + rb):
        return 1
    elif dist < abs(ra - rb):
        if ra > rb:
            return 2
        else:
            return -2
 
for i in xrange(N):
    line = sys.stdin.readline().strip()
    xa, ya, ra, xb, yb, rb = map(float, line.split())
    print calc(xa, ya, ra, xb, yb, rb)
Buggy python submission (verdict: Runtime Error):
import sys

def solve():
    
    while True:
        try:
            n = input()
        
        except EOFError:
            break
        d = sorted(map(int,raw_input().split()))
        for i in range(1,n):
            d[i] += d[i-1]
        print sum(d)
                            
if __name__ == "__main__":
    solve()
    n = raw_input()

Fixed submission:
import sys

def solve():
    
    while True:
        try:
            n = input()        
        except EOFError:
            break
        d = sorted(map(int,raw_input().split()))
        for i in range(1,n):
            d[i] += d[i-1]
        print sum(d)
                            
if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
import sys

def solve():
    c = int(raw_input())
    for i in range(c):
        n = int(raw_input())
        data = map(int, raw_input())
        u,d = 0,0
        for i in range(n - 1):
            if i % 2 == 0:
                if data[i + 1] - data[i] > u:
                    u = data[i + 1] - data[i]
            else:
                if data[i + 1] - data[i] > d:
                    d = data[i + 1] - data[i]
    print u,d

if __name__ == "__main__":
    solve()

Fixed submission:
import sys

def solve():
    c = int(raw_input())
    for i in range(c):
        n = int(raw_input())
        data = map(int, raw_input().split())
        u,d = 0,0
        for i in range(len(data) - 1):
                if data[i + 1] - data[i] > 0 and data[i + 1] - data[i] > u:
                        u = data[i + 1] - data[i] 
                elif data[i + 1] - data[i] < 0 and data[i] - data[i + 1] > d :
                        d = data[i] - data[i + 1]
        print u,d
if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
import sys
import math
"""                                                                             
def solve():                                                                    
    while True:                                                                 
        s = raw_input()                                                         
        if s == "-":                                                            
            return                                                              
        n= int(raw_input())                                                     
        ns = ""                                                                 
        for i in range(n):                                                      
            c = int(raw_input())                                                
            ns = s[c:] + s[:c]                                                  
            s = ns                                                              
        print ns                                                                
"""

def solve():
    a,b,c,d = map(int,raw_input().split())
    r =	(a-c)**2 + (b-d)**2
    r =	math.sqrt(r)
    print r
if __name__ == "__main__":
    solve()

Fixed submission:
import sys
import math
"""                                                                             
def solve():                                                                    
    while True:                                                                 
        s = raw_input()                                                         
        if s == "-":                                                            
            return                                                              
        n= int(raw_input())                                                     
        ns = ""                                                                 
        for i in range(n):                                                      
            c = int(raw_input())                                                
            ns = s[c:] + s[:c]                                                  
            s = ns                                                              
        print ns                                                                
"""

def solve():
    a,b,c,d = map(float,raw_input().split())
    r =	(a-c)**2 + (b-d)**2
    r =	math.sqrt(r)
    print r
if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
S = map(int,raw_input().split())
q = int(raw_input())
T = map(int,raw_input().split())

r = 0

for c in T:
    if c in S:
	r += 1
print r

Fixed submission:
n = input()
S = set(raw_input().split())
q = input()
T = set(raw_input().split())

print (len(S&T))
Buggy python submission (verdict: Runtime Error):
while True:
    [a, b] = map(int, raw_input().split(" "))
    n = a+b
 
    ans = 1
    while(n >= 10):
        n /= 10
        ans += 1
 
    print ans

Fixed submission:
# -*- coding: utf-8 -*-

import sys

for line in sys.stdin.readlines():
    a, b = map(int, line.strip().split())
    n = a + b
    ans = 1
    while(n >= 10):
        n /= 10
        ans += 1
    print ans

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

for line in sys.stdin.readlines():
    a, b = map(int, line.strip().split())
    n = a + b
    ans = 1
    while(n >= 10):
        n /= 10
        ans += 1
    print ans

Fixed submission:
# -*- coding: utf-8 -*-

import sys

for line in sys.stdin.readlines():
    a, b = map(int, line.strip().split())
    n = a + b
    ans = 1
    while(n >= 10):
        n /= 10
        ans += 1
    print ans
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

for line in sys.stdin.readlines():
    #List = map(int, line.strip().split())
    
    seq = raw_input().strip()
    print seq[::-1]

Fixed submission:
# -*- coding: utf-8 -*-

import sys

for line in sys.stdin.readlines():
    #List = map(int, line.strip().split())
    
    seq = line.strip()
    print seq[::-1]
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys


#for line in ["0.0 3.0 -1.0 0.0 -3.0 4.0"]: # expected [-2.000, 2.000, 2.236]
lineNumber = 0
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    List = map(float, line.strip().split())

    # initial parameter
    if lineNumber == 1:
        w = List[0]
        array = [i for i in xrange(1, w+1)]
        contiune
    if lineNumber == 2: continue

    # set data
    [a, b] = List
    a -= 1; b -= 1

    # exchange
    buf = array[a]
    array[a] = array[b]
    array[b] = buf
    
for i in xrange(w):
    print array[i]
    
    

Fixed submission:
# -*- coding: utf-8 -*-

import sys


lineNumber = 0
#for line in [ "5", "4", "2,4", "3,5", "1,2", "3,4" ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    List = map(int, line.strip().split(","))

    # initial parameter
    if lineNumber == 1:
        w = List[0]
        array = [i for i in xrange(1, w+1)]
        continue
    if lineNumber == 2: continue

    # set data
    [a, b] = List
    a -= 1; b -= 1

    # exchange
    buf = array[a]
    array[a] = array[b]
    array[b] = buf
    
for i in xrange(w):
    print array[i]
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys
from math import *

lineNumber = 0
coord = [0, 0]
theta = 0.5 * pi
#for line in [ "2", "1000", "800", "9999999999", "1" ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # line exception
    if lineNumber == 1:
        continue
    
    # get data
    List = map(float, line.strip().split())

    # set data
    forward = List[0]
    d_theta = List[1] / 180.0 * pi

    # solve
    coord[0] += forward * cos(theta)
    coord[1] += forward * sin(theta)
    theta += d_theta

print int(ceil(coord[0]))
print int(ceil(coord[1]))

Fixed submission:
# -*- coding: utf-8 -*-

import sys
from math import *

lineNumber = 0
coord = [0, 0]
theta = 0.5 * pi
#for line in [ "56,65", "97,54", "64,-4", "55,76", "42,-27", "43,80", "87,-86", "55,-6", "89,34", "95,5", "0,0"]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    List = map(float, line.strip().split(","))

    # set data
    forward = List[0]
    d_theta = - List[1] / 180.0 * pi

    # solve
    coord[0] += forward * cos(theta)
    coord[1] += forward * sin(theta)
    theta += d_theta

print int(coord[0])
print int(coord[1])
Buggy python submission (verdict: Runtime Error):


import sys

lineNumber = 0
#for line in [ "xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt." ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    List = map(int, line.strip().split(","))

    List = List.sort().reverse()

    print "%d %d %d %d %d" % (List[0], List[1], List[2], List[3], List[4])

Fixed submission:


import sys

lineNumber = 0

#for line in ["3 6 9 7 5"]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    List = map(int, line.strip().split(" "))

    List.sort()

    print "%d %d %d %d %d" % (List[4], List[3], List[2], List[1], List[0])

Buggy python submission (verdict: Runtime Error):


import sys

lineNumber = 0
#for line in [ "xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt." ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    List = map(int, line.strip().split())

    List = List.sort().reverse()

    print "%d %d %d %d %d" % (List[0], List[1], List[2], List[3], List[4])

Fixed submission:


import sys

lineNumber = 0

#for line in ["3 6 9 7 5"]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # get data
    List = map(int, line.strip().split(" "))

    List.sort()

    print "%d %d %d %d %d" % (List[4], List[3], List[2], List[1], List[0])
Buggy python submission (verdict: Runtime Error):
#coding: utf-8

A = map(int, input().split())
S = A[0] * A[1]
print S / 3.305785

Fixed submission:
A = map(int, raw_input().split(" "))
S = A[0] * A[1]
print S / 3.305785

Buggy python submission (verdict: Runtime Error):
sA = raw_input()
idx = sA.index(" ")
a = int(sA[:idx])
b = int(sA[idx+1:]
S = a * b
print S / 3.305785

Fixed submission:
A = map(int, raw_input().split(" "))
S = A[0] * A[1]
print S / 3.305785
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n = input()
A = []
for i in xrange(n):
    A.append( map(int, raw_input().split()) )

Max = -1
Maxidx = -1
for i in xrange(n):
    if Max < A[i][1]:
        Max = A[i][1]
        Maxidx = i
    elif Max = A[i][1] and A[Maxidx][0] > A[i][0]:
        Maxidx = i

print A[Maxidx][0], A[Maxidx][1]

Fixed submission:
# coding: utf-8

n = input()
A = []
for i in xrange(n):
    A.append( map(int, raw_input().split()) )

Max = -1
Maxidx = -1
for i in xrange(n):
    if Max < A[i][1]:
        Max = A[i][1]
        Maxidx = i
    elif Max == A[i][1] and A[Maxidx][0] > A[i][0]:
        Maxidx = i

print A[Maxidx][0], A[Maxidx][1]
Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n,w,d = LI()
        if n == 0 and w == 0 and d == 0:
            break
        a = [LI() for _ in range(n)]
        r = [(w,d)]
        for p,s in a:
            ww,dd = r.pop(p-1)
            u = ww+dd
            s %= u
            if s < ww:
                r.append((s,dd))
                r.append((ww-s,dd))
            else:
                s -= ww
                r.append((ww,s))
                r.append((ww,dd-s))

        rr.append(' '.join(map(lambda x: str(x[0]*x[1]),sorted(r))))
    return '\n'.join(map(str,rr))


print(main())




Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n,w,d = LI()
        if n == 0 and w == 0 and d == 0:
            break
        a = [LI() for _ in range(n)]
        r = [(w,d)]
        for p,s in a:
            ww, dd = r.pop(p-1)
            u = ww + dd
            s %= u
            tr = []
            if s < ww:
                tr.append((s,dd))
                tr.append((ww-s,dd))
            else:
                s -= ww
                tr.append((ww,s))
                tr.append((ww,dd-s))
            r.extend(sorted(tr,key=lambda x: x[0]*x[1]))

        rr.append(' '.join(map(lambda x: str(x[0]*x[1]), sorted(r,key=lambda x: x[0]*x[1]))))
    return '\n'.join(map(str,rr))


print(main())
Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []
    m = 10**6

    a = [inf] * m
    b = [inf] * m
    a[0] = 0
    b[0] = 0
    for i in range(1,200):
        t = i * (i+1) * (i+2) // 6
        for j in range(t,m):
            if a[j] > a[j-t] + 1:
                a[j] = a[j-t] + 1
        if t % 2 == 0:
            continue
        for j in range(t,m):
            if b[j] > b[j-t] + 1:
                b[j] = b[j-t] + 1

    while True:
        n = I()
        if n == 0:
            break
        rr.append('{} {}'.format(a[n],b[n]))



    return '\n'.join(map(str, rr))


print(main())




Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []
    m = 10**6

    a = [inf] * m
    b = [inf] * m
    a[0] = 0
    b[0] = 0
    for i in range(1,200):
        t = i * (i+1) * (i+2) // 6
        mm = min(t*5,m)
        for j in range(t,mm):
            if a[j] > a[j-t] + 1:
                a[j] = a[j-t] + 1
        if t % 2 == 0:
            continue
        for j in range(t,m):
            if b[j] > b[j-t] + 1:
                b[j] = b[j-t] + 1

    while True:
        n = I()
        if n == 0:
            break
        rr.append('{} {}'.format(a[n],b[n]))



    return '\n'.join(map(str, rr))


print(main())
Buggy python submission (verdict: Time Limit Exceeded):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n):
        a = LI()

        m = {}
        def _f(a):
            l = len(a)
            if l < 2:
                return 0
            k = tuple(a)
            if k in m:
                return m[k]
            r = 0
            for i in range(len(a)-1):
                if abs(a[i]-a[i+1]) >= 2:
                    continue
                t = _f(a[:i] + a[i+2:]) + 2
                if r < t:
                    r = t
            m[k] = r
            return r

        return _f(a)

    while True:
        n = I()
        if n == 0:
            break
        rr.append(f(n))

    return '\n'.join(map(str, rr))



print(main())



Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n):
        a = LI()
        l = len(a)
        s = set()
        r = 0
        for i in range(l-1):
            if abs(a[i] - a[i+1]) < 2:
                s.add((i,i+1))
        for i in range(4, l+1):
            for j in range(l-i+1):
                k = j + i - 1
                if (j+1, k-1) in s and abs(a[j] - a[k]) < 2:
                    s.add((j,k))
                    continue
                for m in range(j+2,k,2):
                    if (j,m-1) in s and (m,k) in s:
                        s.add((j,k))
                        break

        m = {}
        m[l] = 0
        def _f(i):
            if i in m:
                return m[i]
            r = 0
            for j in range(i,l+1):
                t = _f(j+1)
                if (i,j) in s:
                    t += j - i + 1
                if r < t:
                    r = t
            m[i] = r
            return r
        return _f(0)

    while True:
        n = I()
        if n == 0:
            break
        rr.append(f(n))

    return '\n'.join(map(str, rr))



print(main())
Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    k,r,l = LI()
    p = F()
    e = F()
    t = F()

    def f(k,r,l):
        if abs(r-t) <= e and abs(t-l) <= e:
            return 1
        if k == 0:
            if abs(t - (r+l) / 2) <= e:
                return 1
            return 0

        h = (r+l) / 2
        if h >= t:
            return f(k-1,r,h) * (1-p) + f(k-1,h,l) * p
        return f(k-1,r,h) * p + f(k-1,h,l) * (1-p)

    tr = f(k,r,l)

    return '{:0.9f}'.format(tr)



print(main())



Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    k,r,l = LI()
    p = F()
    e = F()
    t = F()

    def f(k,r,l):
        if abs(r-t) <= e and abs(t-l) <= e:
            return 1
        if t-l > e or r-t > e:
            return 0
        if k == 0:
            if abs(t - (r+l) / 2) <= e:
                return 1
            return 0

        h = (r+l) / 2
        if h >= t:
            return f(k-1,r,h) * (1-p) + f(k-1,h,l) * p
        return f(k-1,r,h) * p + f(k-1,h,l) * (1-p)

    tr = f(k,r,l)

    return '{:0.9f}'.format(tr)



print(main())