def ordinal(string, d):
	"""Return the ordinal of the character at dth position. 
	Specifically, the ordinal of end-of-string is defined to be -1.
	"""
	if d < len(string): 
		return ord(string[d])
	elif d == len(string): 
		return -1
	else: 
		raise IndexError