solved this problem by 3 ways