Amazon beats on top and bottom lines