Programmers working on a large project have just received a task to write exactly *m* lines of code. There are *n* programmers working on a project, the *i*-th of them makes exactly *a*<sub class="lower-index">*i*</sub> bugs in every line of code that he writes. 

Let's call a sequence of non-negative integers *v*<sub class="lower-index">1</sub>, *v*<sub class="lower-index">2</sub>, ..., *v*<sub class="lower-index">*n*</sub> a plan, if *v*<sub class="lower-index">1</sub> + *v*<sub class="lower-index">2</sub> + ... + *v*<sub class="lower-index">*n*</sub> = *m*. The programmers follow the plan like that: in the beginning the first programmer writes the first *v*<sub class="lower-index">1</sub> lines of the given task, then the second programmer writes *v*<sub class="lower-index">2</sub> more lines of the given task, and so on. In the end, the last programmer writes the remaining lines of the code. Let's call a plan good, if all the written lines of the task contain at most *b* bugs in total.

Your task is to determine how many distinct good plans are there. As the number of plans can be large, print the remainder of this number modulo given positive integer *mod*.
The first line contains four integers *n*, *m*, *b*, *mod* (1 ≤ *n*, *m* ≤ 500, 0 ≤ *b* ≤ 500; 1 ≤ *mod* ≤ 10<sup class="upper-index">9</sup> + 7) — the number of programmers, the number of lines of code in the task, the maximum total number of bugs respectively and the modulo you should use when printing the answer.

The next line contains *n* space-separated integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 500) — the number of bugs per line for each programmer.
import sys
from collections import *
from itertools import *
from math import *
from array import *
from functools import lru_cache
import heapq
import bisect
import random
import io, os

if sys.hexversion == 50924784:
    sys.stdin = open('cfinput.txt')

# input = sys.stdin.readline
# input_int = sys.stdin.buffer.readline
# RI = lambda: map(int, input_int().split())
# RS = lambda: input().strip().split()
# RILST = lambda: list(RI())

RI = lambda: map(int, sys.stdin.buffer.readline().split())
RS = lambda: sys.stdin.readline().strip().split()
RILST = lambda: list(RI())

MOD = 10 ** 9 + 7
"""http://codeforces.com/problemset/problem/543/A

输入 n (1≤n≤500) m (1≤m≤500) b (0≤b≤500) mod (1≤mod≤1e9+7) 和一个长为 n 的数组 a (0≤a[i]≤500)。

你接手了一个有很多祖传代码的老项目，该项目由 n 个程序员开发，目前有 m 行代码。
已知第 i 个程序员在一行代码中会产生 a[i] 个 bug。
你尚不知道每个程序员分别写了多少行代码，于是你思考：有多少种方案，能使项目的 bug 数量不超过 b 个？由于答案很大，你需要输出答案模 mod 的结果。

注意：两种方案不同，当且仅当某个程序员编写的行数不同。
可能有程序员一行代码都不写。
输入
3 3 3 100
1 1 1
输出 10

输入
3 6 5 1000000007
1 2 3
输出 0

输入
3 5 6 11
1 2 1
输出 0
"""
""" 背包
f[i][j][k] 前i个程序员写了j行代码，共产生k个bug的方案数
"""


# 	 ms
def solve(n, m, b, mod, a):
    f = [[0] * (b + 1) for _ in range(m + 1)]
    f[0][0] = 1
    for v in a:
        for i in range(1, m + 1):
            for j in range(v, b + 1):
                f[i][j] = (f[i][j] + f[i - 1][j - v]) % mod
                # f[i][j] += f[i - 1][j - v]
    print(sum(f[-1]) % mod)


if __name__ == '__main__':
    n, m, b, mod = RI()
    a = RILST()

    solve(n, m, b, mod, a)
