Sarah, Esther, and Rebbi Akiva

How could Rashi say all the years of Sarah were equal for good - she waited 90 years to have a son, she was abducted twice, and more? What is the connection between Sarah's 127 years and Esther?

Being a ger and a toshav.