Instagram's sharding function. (see http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram for explanation)