calculate male and female ratio at backend