Berland Football Cup starts really soon! Commentators from all over the world come to the event.

Organizers have already built $n$ commentary boxes. $m$ regional delegations will come to the Cup. Every delegation should get the same number of the commentary boxes. If any box is left unoccupied then the delegations will be upset. So each box should be occupied by exactly one delegation.

If $n$ is not divisible by $m$, it is impossible to distribute the boxes to the delegations at the moment.

Organizers can build a new commentary box paying $a$ burles and demolish a commentary box paying $b$ burles. They can both build and demolish boxes arbitrary number of times (each time paying a corresponding fee). It is allowed to demolish all the existing boxes.

What is the minimal amount of burles organizers should pay to satisfy all the delegations (i.e. to make the number of the boxes be divisible by $m$)?


-----Input-----

The only line contains four integer numbers $n$, $m$, $a$ and $b$ ($1 \le n, m \le 10^{12}$, $1 \le a, b \le 100$), where $n$ is the initial number of the commentary boxes, $m$ is the number of delegations to come, $a$ is the fee to build a box and $b$ is the fee to demolish a box.


-----Output-----

Output the minimal amount of burles organizers should pay to satisfy all the delegations (i.e. to make the number of the boxes be divisible by $m$). It is allowed that the final number of the boxes is equal to $0$.


-----Examples-----
Input
9 7 3 8

Output
15

Input
2 7 3 7

Output
14

Input
30 6 17 19

Output
0



-----Note-----

In the first example organizers can build $5$ boxes to make the total of $14$ paying $3$ burles for the each of them.

In the second example organizers can demolish $2$ boxes to make the total of $0$ paying $7$ burles for the each of them.

In the third example organizers are already able to distribute all the boxes equally among the delegations, each one get $5$ boxes.

Difficulty: interview

Starter code:

Solutions:
n, m, a, b = list(map(int, input().split()))

k = n%m
print(min(k*b, (m - k)*a))


n,m,a,b=list(map(int,input().split()))
print(min((n%m)*b,(m-(n%m))*a))


(n, m, a, b) = list(map(int, input().split()))

if n % m == 0:
    print(0)
else:
    k1 = n % m
    k2 = m - k1
    print(min(k1 * b, k2 * a))


n, m, a, b = list(map(int, input().split()))
if (n % m == 0):
    print(0)
else:
    print(min((n % m) * b, (m - (n % m)) * a))


n, m, a, b = list(map(int, input().split()))
print(min(a*(m - n%m), b*(n%m)))


n, m, a, b = list(map(int, input().split()))
print(min(n%m*b, (m-n%m)*a))


def ii():
    return int(input())
def mi():
    return map(int, input().split())
def li():
    return list(mi())

n, m, a, b = mi()
d = n % m
c1 = d * b
c2 = (m - d) * a
print(min(c1, c2))

n, m, a, b = list(map(int, input().split()))

print(min((n % m) * b, (m - (n % m)) * a))


from sys import stdin, stdout


n, m, a, b = map(int, stdin.readline().split())
ans = float('inf')

if not n % m:
    stdout.write('0')
else:
    mod = n % m
    ans = min(ans, mod * b)
    ans = min(ans, (m - mod) * a)
    
    stdout.write(str(ans))

n, m, a ,b = list(map(int,input().split()))
ans = 100000000000000000000
if n % m == 0 :
    ans = 0
k = n % m
ans = min(ans, k * b , (m - k) * a)


print(ans)


n, m, a, b = map(int, input().split())

if (n % m == 0):
    print(0)
else:
    print(min((n % m) * b, (m - (n % m)) * a))

n, m, a, b = map(int, input().split())
t1 = n % m
t2 = m - t1
t1 *= b
t2 *= a
print(min(t1, t2))

n, m, a, b = map(int, input().split())

d = n % m
print(min(d * b, (m - d) * a))

n, m, a, b = [int(v) for v in input().split()]

down = (n // m) * m
up = ((n + m - 1) // m) * m

cost_down = (n - down) * b
cost_up = (up - n) * a

print(min(cost_down, cost_up))


# python3

def readline():
    return list(map(int, input().split()))


def main():
    n, m, a, b = readline()
    remove = (n % m) * b
    add = (m - n % m) * a
    print(min(add, remove))
    

def __starting_point():
    main()

__starting_point()

n, m, a, b = list(map(int, input().split()))
print(min((n%m)*b, (m - n%m)*a))


#     Educational Codeforces Round 45 (Rated for Div. 2)
import collections
from functools import cmp_to_key
#key=cmp_to_key(lambda x,y: 1 if x not in y else -1 )

import sys
def getIntList():
    return list(map(int, input().split()))    

 
            
    
n,m, a,b = getIntList()

z = n%m

r = min( (m-z) * a ,  z * b)


print(r)


n, m, a, b = [int(x) for x in input().split()]

res = (n % m) * b
res = min(res, ((m - (n % m)) % m) * a)

print(res)


n, m, a, b = list(map(int, input().split()))

if n % m == 0:
	print(0)
else:
	t = n // m
	t *= m
	print(min(a * (t + m - n), b * (n - t)))


n, m, a, b = map(int, input().split())
ans = int("9" * 20)
ans = min(ans, (n % m) * b)
ans = min(ans, (m - (n % m)) * a)
print(ans)

import sys
import io

stream_enable = 0

inpstream = """
2 7 3 7
"""

if stream_enable:
    sys.stdin = io.StringIO(inpstream)
    input()

def inpmap():
    return list(map(int, input().split()))

n, m, a, b = inpmap()
x = (n % m) * b
y = (m - n % m) * a
print(min(x, y))


#JMD
#Nagendra Jha-4096
 
#a=list(map(int,sys.stdin.readline().split(' ')))
#n,k,s= map(int, sys.stdin.readline().split(' '))
 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
n,m,a,b= map(int, sys.stdin.readline().split(' '))
val=(m-(n%m))*a
v2=(n%m)*b
print(min(val,v2))


#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

n,m,a,b = list( map(int, input().split()))

print(min((n % m)*b, (m-(n%m))*a))

n, m, a, b = list(map(int, input().split()))
if n % m == 0:
    print(0)
else:
    res1 = (n % m) * b
    res2 = (m - n % m) * a
    print(min(res1, res2))