The general ratio is 1.25qts/lb to mash. Sparge calculation has to do with total batch size desired so basically you need to figure out some numbers first:
Total batch size final volume
Total water required to mash including grain absorption
Total sparge water needed
Total pre-boil volume required
Total boil off amount
Dead space loss in Mash Tun
Dead space/trub in kettle
Trub loss in Primary
Final bottling volume
You may have to brew a few batches to get a handle on how your system works to dial in all these volumes. Brewing software is a big help

You can also do a dry run with just water. Example, fill your mash tun with water and drain, the amount of water that does not drain is your MT loss, same can be done with the kettle, etc.