update problem #3

re wrote code to include Modulo and fix expression.