At its borders in 1707, the Kingdom of Scotland was half the size of England and Wales in area, but with its many inlets, islands and inland lochs, it had roughly the same amount of coastline at 4000 miles .