def calc(r, n)
    res = 0
    sum = r
    base = 1
    bs = r
    while n > 0
        if n%2 == 1
            res += sum * base
            base *= bs
        end
        sum *= 1+bs
        bs *= bs
        n /= 2
        res %= MOD
        sum %= MOD
        base %= MOD
        bs %= MOD
    end
    res
end

def calc2(r, n)
    res = 0
    sum = r
    base = 1
    bs = r
    num = 0
    b = 1
    while n > 0
        if n%2 == 1
            res += (sum + num * calc(r, b)) * base
            num += b
            base *= bs
        end
        sum *= 1+bs
        sum += b * bs * calc(r, b)
        bs *= bs
        b *= 2
        n /= 2
        res %= MOD
        sum %= MOD
        base %= MOD
        bs %= MOD
    end
    res
end

def power_mod(num, power)
    prod = 1
    num %= MOD
    while power > 0 do
        if power & 1 == 1
            prod = (prod * num) % MOD
        end
        num = (num * num) % MOD
        power >>= 1
    end
    return prod
end

L, A, B, MOD = gets.split.map(&:to_i)
C = A + B*(L-1)

mn = 1
mx = 9
ans = 0
(1..18).each do |d|
    if d > 1
        mn *= 10
        mx = (mx+1) * 10 - 1
    end
    l = [0, (mn-A-1)/B+1].max
    r = [L-1, (mx-A)/B].min
    if l <= r
        rnum = A + B*r
        num = r-l+1
        ans *= power_mod(10, num*d)
        b = power_mod(10, d)
        ans += rnum * (1 + calc(b, num-1))
        ans -= B * calc2(b, num-1)
        ans %= MOD
    end
end
puts ans