import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") n = int(input()) dxy = [ [3,0],[-3,0], [0,3],[0,-3], [2,3],[3,2], [-2,3],[-3,2], [2,-3],[3,-2], [-2,-3],[-3,-2] ] def sub(n): s = set() v = (0,0) s = [v] for _ in range(n): ns = set() for v in s: xx,yy = v for x,y in dxy: ns.add((x+xx,y+yy)) s = ns return (s) if n<7: ans = len(sub(n)) elif n%2==0: ans = ((6*n+1)**2 - 1)//2 - (n**2) + 1 else: ans = ((6*n+1)**2 - 1)//2 - (n**2-1) M = 10**9+7 print(ans%M)