Buggy python submission (verdict: Runtime Error):
n = input()

def scalar(n):
   for i in range(0, len(n)):
      for j in range(0, len(n)):
         m[i][j] = 0

   for l in range(2, len(n)):
      for i in range(0, len(n)):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))

   print m[0][len(n)-1]

for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

   

Fixed submission:
n = input()
M = []
 
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
 
   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
 
   print m[0][len(n)-1]
 
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

Buggy python submission (verdict: Runtime Error):
n = input()
 
def scalar(n):
   m = [[for i in range(0, len(n))] for j in range(0, len(n))]
 
   for l in range(2, len(n)):
      for i in range(0, len(n)):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
 
   print m[0][len(n)-1]
 
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)
 

Fixed submission:
n = input()
M = []
 
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
 
   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
 
   print m[0][len(n)-1]
 
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

Buggy python submission (verdict: Runtime Error):
n = input()
  
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
  
   for l in range(2, len(n)):
      for i in range(0, len(n)):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
  
   print m[0][len(n)-1]
  
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

Fixed submission:
n = input()
M = []
 
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
 
   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
 
   print m[0][len(n)-1]
 
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

Buggy python submission (verdict: Runtime Error):
n = input()
??????
def scalar(n):
??????m = [[0 for i in range(len(n))] for j in range(len(n))]
??????
??????for l in range(2, len(n)+1):
????????????for i in range(0, len(n)-l+1):
??????????????????j = i + l - 1
??????????????????m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
??????
??????print m[0][len(n)-1]
??????
for i in range(n):
??????M.append(map(int, raw_input().split()))
scalar(M)

Fixed submission:
n = input()
M = []
 
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
 
   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
 
   print m[0][len(n)-1]
 
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

Buggy python submission (verdict: Runtime Error):
n = input()

def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]

   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))

   print m[0][len(n)-1]

for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

Fixed submission:
n = input()
M = []
 
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
 
   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
 
   print m[0][len(n)-1]
 
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)