print eval<>=~s/(\d+)\n/*\1==/r.<>=~s/ /+/gr?YES:NO