Model Counting and Sampling via Semiring Extensions | Synapse