#P2371. 墨墨的等式

墨墨的等式

墨墨的等式

题目描述

给定 nn 个非负整数 a1,a2,,ana_1,a_2,\ldots,a_n 以及区间 [l,r][l,r]

对于一个整数 bb,若存在一组非负整数 x1,x2,,xnx_1,x_2,\ldots,x_n,使得

i=1naixi=b,\sum_{i=1}^{n} a_i x_i=b,

则称 bb 是可表示的。

请统计区间 [l,r][l,r] 中有多少个整数是可表示的。

输入格式

第一行包含三个整数 n,l,rn,l,r

第二行包含 nn 个整数 a1,a2,,ana_1,a_2,\ldots,a_n

输出格式

输出一行一个整数,表示区间 [l,r][l,r] 中可表示整数的个数。

样例输入 1

2 5 10
3 5

样例输出 1

5

数据范围

对于全部数据:

  • 1n121\le n\le 12
  • 0ai5×1050\le a_i\le 5\times 10^5
  • 1lr10121\le l\le r\le 10^{12}