// naive #include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; struct Skill { ll x, y, p, s; }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector skills(n); for (auto &skill : skills) { cin >> skill.x >> skill.y >> skill.p >> skill.s; } sort(skills.begin(), skills.end(), [](const Skill &a, const Skill &b) { return a.s > b.s; }); vector event_times(m); for (ll &t : event_times) cin >> t; const mint inv100 = mint(100).inv(); mint answer = 0; for (ll t : event_times) { mint no_higher_boost = 1; for (const auto &skill : skills) { ll first_k = max(1LL, (t - skill.y) / skill.x + 1); ll last_k = t / skill.x; mint no_active_boost = 1; const mint no_success = mint(1) - mint(skill.p) * inv100; for (ll k = first_k; k <= last_k; ++k) { no_active_boost *= no_success; } answer += mint(skill.s) * no_higher_boost * (mint(1) - no_active_boost); no_higher_boost *= no_active_boost; } answer += no_higher_boost; } cout << answer.val() << '\n'; }