# coding=utf-8

if __name__ == '__main__':
    X, K, D = map(int, input().split())

    ABS_X = abs(X)

    if K * D <= ABS_X:
        ans = ABS_X - (K * D)

    else:
        r = ABS_X // D
        l = ABS_X // D + 1
        if r % 2 == K % 2:
            ans = abs(ABS_X - D * r)
        else:
            ans = abs(ABS_X - D * l)

    print(ans)
 if __name__ == '__main__':
    X, K, D = map(int, input().split())

    ABS_X = abs(X)

    if K * D <= ABS_X:
        ans = ABS_X - (K * D)

    else:
        r = ABS_X // D
        l = ABS_X // D + 1
        if r % 2 == K % 2:
            ans = abs(ABS_X - D * r)
        else:
            ans = abs(ABS_X - D * l)

    print(ans) __name__ == '__main__' __name__ '__main__' X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D ABS_X = abs(X) ABS_X abs(X) abs X if K * D <= ABS_X:
        ans = ABS_X - (K * D)

    else:
        r = ABS_X // D
        l = ABS_X // D + 1
        if r % 2 == K % 2:
            ans = abs(ABS_X - D * r)
        else:
            ans = abs(ABS_X - D * l)

     K * D <= ABS_X K * D K D ABS_X ans = ABS_X - (K * D) ans ABS_X - (K * D) ABS_X K * D K D r = ABS_X // D r ABS_X // D ABS_X D l = ABS_X // D + 1 l ABS_X // D + 1 ABS_X // D ABS_X D 1 if r % 2 == K % 2:
            ans = abs(ABS_X - D * r)
        else:
            ans = abs(ABS_X - D * l)

     r % 2 == K % 2 r % 2 r 2 K % 2 K 2 ans = abs(ABS_X - D * r) ans abs(ABS_X - D * r) abs ABS_X - D * r ABS_X D * r D r ans = abs(ABS_X - D * l) ans abs(ABS_X - D * l) abs ABS_X - D * l ABS_X D * l D l print(ans) print ans ABS_X = abs(X) abs(X) ABS_X X, K, D = map(int, input().split()) map(int, input().split()) X ans = ABS_X - (K * D) ABS_X - (K * D) ans r = ABS_X // D ABS_X // D r ans = abs(ABS_X - D * l) abs(ABS_X - D * l) ans K, D = map(int, input().split()) map(int, input().split()) K ans = abs(ABS_X - D * r) abs(ABS_X - D * r) ans D = map(int, input().split()) map(int, input().split()) D l = ABS_X // D + 1 ABS_X // D + 1 l
# coding=utf-8

if __name__ == '__main__':
    X, K, D = map(int, input().split())

    ABS_X = abs(X)

    if K * D <= ABS_X:
        ans = ABS_X - (K * D)

    else:
        r = ABS_X // D
        l = ABS_X // D + 1
        if r % 2 == K % 2:
            ans = abs(ABS_X - D * r)
        else:
            ans = abs(ABS_X - D * l)

    print(ans)

