solve problem#30 (by rude method)