added solutions in R