sumin's weight function