gcds
题号:NC237448
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

For any positive integer sequence , define its weight

Here . p,q,r,m are given constants。

Calculate the sum of the weight of all such sequences whose sum is n

The answer might be very huge, print it module .

输入描述:

The first line contains two integers n,m (  ), denoting the sum and length of the sequence。

Second line contains three integers p,q,r ( ).

输出描述:

Output one line containing the answer,  .
示例1

输入

复制
10 5
3 2 1

输出

复制
40120
示例2

输入

复制
1000 10
1312 123 345

输出

复制
922437392