modify algorithm of medal calculation