Peace be upon you. According to Grand Ayatollah Khamenei (may Allah protect him): You must make up any prayer you are certain you performed while in a state of impurity without a valid purification. As for fasting, if you committed this act while fasting and were aware that it invalidates the fast, you must make up the fast and pay a penalty. If you were unaware of this but knew it was forbidden, in addition to making up the fast, you are required to pay a penalty as a precaution. If you were unaware of the prohibition, you only need to make up the fast. Regarding the following days, if you were ignorant of the issue of impurity or were certain that fasting is valid while remaining in a state of impurity, you do not need to make it up, and your fast is considered valid. However, it is advisable to make it up in the latter case. If you were aware of the issue of impurity but uncertain about the necessity of purification, you should make up those days as a precaution; otherwise, you must make up the fast and pay a penalty together.
Source: Special Inquiry: [1](
https://islamq2a.com/masdar/94.jpg), [2](
https://www.islamq2a.com/masdar/758.png).
According to Grand Ayatollah Sistani (may Allah protect him): You must make up any prayers you performed after becoming impure until the first valid purification you undertook, whether obligatory or recommended, such as the Friday bath. If you are unsure of the number of those prayers, it suffices to make up the certain ones, meaning the least number. You do not need to make up the fast if you were ignorant of the ruling and were excused in your ignorance.
Source: Official website: [1](
https://www.sistani.org/arabic/qa/7929/), [2](
https://www.sistani.org/arabic/qa/0615/). May you be successful in all good.