Let X be the distance Sam ran.
His walk through the store was twice the distance of his run, so his walk was 2X.
He biked for 12 miles and went 18 miles in all, so he walked and ran 18 - 12 = <<18-12=6>>6 miles.
Thus, his walk and run together were X + 2X = 3X = <<6=6>>6 miles.
Thus, he ran X = 6 / 3 = <<6/3=2>>2 miles.
#### 2