from heapq import *
g={'А':{'Б':20,'В':60},'Б':{'А':20,'В':30,'Г':90},'В':{'А':60,'Б':30,'Г':50},'Г':{'Б':90,'В':50}}
h,s=[(0,'А')],{}
while h:
w,v=heappop(h)
if v=='Г':print(w);break
if v in s:continue
s[v]=1
for u in g[v]:heappush(h,(w+g[v][u],u))
Ответ: 100