front and back dp(338,940の該当)