#JavaScript (ES6), 45 bytes <!-- language-all: lang-javascript --> s=>+(n=s.split`/`[0])?[n*n-1?n:'-'[~n]]+'b':n [Try it online!](https://tio.run/##bc7LCsIwEIXhvS8yiWXSpFEohdgHCYFebKUSJsUUl756XLiT2X6L/5zn@B7z/Nr2Ayndl7K6kt2tEuSyynvcjqEevA6y93QmND11gOA/FEIFE3RU5kQ5xUXF9BCrgEutQcrTnxpWNastz9jyZXVlvVHa8h3@C1pl@O8Tq5Zn5Nk0v9XyBQ "JavaScript (Node.js) – Try It Online")