
def Main(a, b, c, d):

    """

    :param a:
    :param b:
    :param c:
    :param d:
    :return:
    """
    f = b * d

    g = d / c

    q = a + f

    m = q + g

    h = m - q

    j = h % g

    return j
