MOD = 998244353 INV100 = pow(100, MOD - 2, MOD) def main(): N, _ = map(int, input().split()) skills = [] for _ in range(N): x, y, p, s = map(int, input().split()) skills.append((x, y, p, s)) skills.sort(key=lambda skill: skill[3], reverse=True) times = list(map(int, input().split())) answer = 0 for t in times: no_higher_boost = 1 for x, y, p, s in skills: count = t // x - max(0, t - y) // x if count > 0: no_active = pow((100 - p) * INV100 % MOD, count, MOD) answer += s * no_higher_boost * (1 - no_active) answer %= MOD no_higher_boost = no_higher_boost * no_active % MOD answer = (answer + no_higher_boost) % MOD print(answer) if __name__ == "__main__": main()