Unified framework for magic state distillation and multiqubit gate synthesis with reduced resource cost | Synapse