Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    if D>0:
        a = int((X+K*D)/(2*D))
        for i in range(-2,3):
            if a+i <= K and a+i >= 0:
                #ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
                ans_temp = K-2*(a+i)
                ans_list.append(abs(X + ans_temp*D))
        ans = min(ans_list)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    if D>0:
        a = int((X+K*D)/(2*D))
        for i in range(-1,2):
            if a+i <= K and a+i >= 0:
                #ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
                ans_temp = K-2*(a+i)
                ans_list.append(abs(X + ans_temp*D))
        ans = min(ans_list)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    if D>0:
        a = int((X+K*D)/(2*D))
        for i in range(-1,2):
            if a+i <= K and a+i >= 0:
                #ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
                ans_list.append(abs(X+K*D-2*(a+i)*D))
        ans = min(ans_list)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    if D>0:
        a = int((X+K*D)/(2*D))
        for i in range(-2,3):
            if a+i <= K and a+i >= 0:
                #ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
                ans_list.append(abs(X+K*D-2*(a+i)*D))
        ans = min(ans_list)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    if D>0:
        a = int((X+K*D)/(2*D))
            ans = abs(X+(K-a)*D - a*D)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    if D>0:
        a = int((X+K*D)/(2*D))
            ans = abs(X+(K-(a+i))*D - (a+i)*D)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    if D>0:
        a = int((X+K*D)/(2*D))
        for i in range(-2,3):
            if a+i <= K and a+i >= 0:
                ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
        ans = min(ans_list)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = int((X+K*D)/(2*D))
    for i in range(-2,3):
        if a+i <= K and a+i >= 0:
            ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
    ans = min(ans_list)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    for i in range(-2,3):
        if a+i <= K and a+i >= 0:
            ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
    ans = min(ans_list)
print(ans)




Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    for i in range(-3,4):
        if a+i <= K and a+i >= 0:
            ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
    ans = min(ans_list)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    for i in range(-1,2):
        if a+i <= K and a+i >= 0:
            ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
    ans = min(ans_list)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    for i in range(-2,3):
        if a+i <= K and a+i >= 0:
            ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
    ans = min(ans_list)
print(ans)    

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    for i in range(-2,3):
        if a+i <= K and a+i >= 0:
            ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
    ans = min(ans_list)
print(ans)    

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)

Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    for i in range(-2,3):
        if a+i <= K and a+i >= 0:
            ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
    ans = min(ans_list)
print(ans)    

Fixed submission:
X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)