/** author: shobonvip created: 2026.12.05 00:08:41 **/ #include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) #define all(v) v.begin(), v.end() template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n,m; cin >> n >> m; vector x(n),y(n),s(n); vector p(n); rep(i,0,n){ ll pt; cin >> x[i] >> y[i] >> pt >> s[i]; p[i] = mint(pt) / 100; } vector> ft; rep(i,0,n) { ft.emplace_back(s[i],x[i],y[i],ll(p[i].val())); } sort(all(ft)); reverse(all(ft)); rep(i,0,n) { auto [st,xt,yt,pt] = ft[i]; s[i] = st; x[i] = xt; y[i] = yt; p[i] = mint(pt); } mint ans = 0; rep(i,0,m) { ll t; cin >> t; mint now_p = 1; rep(j,0,n) { if (t / x[j] * x[j] + y[j] <= t) { continue; } ll ub = t / x[j]; // ok ll lb = 0; // ng while (ub - lb > 1) { ll k = (ub + lb) / 2; if (k * x[j] + y[j] > t) ub = k; else lb = k; } ll kasane = t / x[j] - ub + 1; mint prob = (1 - p[j]).pow(kasane); ans += s[j] * now_p * (1 - prob); now_p *= prob; } ans += now_p; } cout << ans.val() << endl; }