Problem:


				Max Score: $250$ Points 

Problem Statement

					Snuke has a very long calendar. It has a grid with $n$ rows and $7$ columns. One day, he noticed that calendar has a following regularity. 

The cell at the $i$-th row and $j$-th column contains the integer $7i+j-7$.

					A good sub-grid is a $3 \times 3$ sub-grid and the sum of integers in this sub-grid mod $11$ is $k$. 

					How many good sub-grid are there? Write a program and help him. 

Input

						The input is given from standard input in the following format. 

$n \quad k$

Output

Print the number of good sub-grid. If there are no solution exists, print 0.

Constraints

$1 \le n \le 10^9$

$0 \le k \le 10$

Subtasks

Subtask 1 [ $150$ points ]

The testcase in the subtask satisfies $1 \le n \le 100$.

Subtask 2 [ $100$ points ]

There are no additional constraints.

Sample Input 1

7 7

Sample Output 1

2

					In this case, the calendar likes this matrix.

Sun.
Mon.
Tue.
Wed.
Thu.
Fri.
Sat.

Week 1
1
2
3
4
5
6
7

Week 2
8
9
10
11
12
13
14

Week 3
15
16
17
18
19
20
21

Week 4
22
23
24
25
26
27
28

Week 5
29
30
31
32
33
34
35

Week 6
36
37
38
39
40
41
42

Week 7
43
44
45
46
47
48
49

					The cell at $i$-th row and $j$-th column is denoted $(i, j)$. 

If upper-left is $(1, 5)$, the sum of integers is $5+6+7+12+13+14+19+20+21=117$.

If upper-left is $(3, 2)$, the sum of integers is $16+17+18+23+24+25+30+31+32=216$.

					Therefore, there are 2 good sub-grids.

Sample Input 2

6 0

Sample Output 2

2

					If upper-left is $(1, 3)$ or $(4, 4)$, it is a good sub-grid.

Sample Input 3

18 10



Sample input:
7 7


Sample output:
2

Submission status: Accepted

Solution code:
n,k=map(int, input().split())

#11段で1周するのでそこまで計算する
r=[]
for i in range(1,12):
    m=0
    for j in range(1,6):
        t = 0
        for x in range(3):
            for y in range(3):
                t += 7*(i+y) + (j+x) - 7
        if t % 11 == k: m += 1
    r.append(m)

a,b=divmod(n,11)
ans = 0
ans += a*sum(r)
if b < 1: ans -= r[-2]
if b < 2: ans -= r[-1]
if b >= 3:
    for i in range(b-2): ans += r[i]
print(ans)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
if N<3:
    print(0)
    exit()

table = [[0]*5 for i in range(11)]
for i in range(11):
    for j in range(5):
        t = 9*(j+2 + 7*(i+1))
        table[i][j] = t%11

c = [0]
for row in table:
    c.append(c[-1] + row.count(K))

d,m = divmod(N-2, 11)
ans = c[m] + c[-1]*d
print(ans)

Submission status: Accepted

Solution code:
def examA():
    N, L = LI()
    V, D = LI()
    X = [LI()for _ in range(N)]

    ans = 0
    print(ans)
    return

def examB():
    N, K = LI()
    H = 11; W = 7
    S = [[0]*(W+1) for _ in range(H+3)]
    for h in range(H+2):
        for w in range(W):
            S[h+1][w+1] = (S[h][w+1] + S[h+1][w] - S[h][w] + (7*h+w+1))
    #print(S)
    base = 0
    for h in range(H):
        for w in range(W-2):
            cur = S[h+3][w+3] - S[h+3][w] - S[h][w+3] + S[h][w]
            if cur%11==K:
                base += 1
                #print(h,w)
    ans = base * ((N-2)//11)
    #print(ans)
    rest = (N-2)%11
    for h in range(rest):
        for w in range(W-2):
            cur = S[h+3][w+3] - S[h+3][w] - S[h][w+3] + S[h][w]
            if cur%11==K:
                ans += 1
                #print(h,w)
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examB()

"""

"""

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
n -= 2
ans = n//11*5

for i in range(n//11*11+1, n+1):
    for j in range(5):
        s = (7*i-6)*9+72+9*j
        if s % 11 == k:
            # print(i, j, s, k)
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
def main():
    N, K = map(int, input().split())
    if N < 3:
        print(0)
        return
    seq = [0] * 11
    for i in range(11):
        total = ((i+1) * 7 + 2) * 9
        for j in range(5):
            if total % 11 == K:
                seq[i] += 1
            total += 9
        if i > 0:
            seq[i] += seq[i-1]
    ans = (N - 3) // 11 * seq[10] + seq[(N-3) % 11]
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

n, k = [ int(v) for v in input().split() ]
mod_list = [6,4,2,0,9,7,5,3,1,10,8]
g = mod_list.index(k)
corumn_list = [ None for i in range(5) ]

for i in range(11):
    for j in range(1,6):
        if (7*i+j) % 11 == g and corumn_list[j-1] is None:
            corumn_list[j-1] = i

m = (n-3)%11
ans = (5*((n-3)//11)+sum([m >= i  for i in corumn_list]))
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,K = map(int,input().split())

answer = 0
for x in [17,18,19,20,21]:
    # y = x + 7t, 0 <= t <= n-3
    # 9y - 72 - K が11の倍数
    first_t = 0
    while (9*(x+7*first_t)-72)%11 != K:
        first_t += 1
    cnt = ((N-3) - first_t)//11 + 1
    answer += cnt
print(answer)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N,K=MAP()

# 循環の1周に何がどう含まれるかを予め作っておく
grid=[[0]*5 for i in range(11)]
for i in range(11):
    num=81+i*63
    for j in range(5):
        grid[i][j]=num%11
        num+=9

# 1循環中の要素数確認 → 全部5つずつ
# C=Counter()
# for i in range(11):
#     C.update(grid[i])

# 循環している回数*5
# 最後の2行は3*3の正方形を作れないので除く
ans=(N-2)//11*5
# 最後の1回は必要なところまでを数える
mod=(N-2)%11
for i in range(mod):
    for j in range(5):
        if grid[i][j]==K:
            ans+=1
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
a = 7*N // 11
ans = a
for i in range(a*11+1, 7*N+1):
    if 9*i % 11 == K:
        ans += 1

ans -= N//11*2
for i in range(N//11*11, N):
    if (7*i + 1)*9 % 11 == K:
        ans -= 1
    if (7*i + 7)*9 % 11 == K:
        ans -= 1
for i in range(2, 7):
    if i*9 % 11 == K:
        ans -= 1
    if N > 1 and (7*N + i - 7)*9 % 11 == K:
        ans -= 1
print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,input().split());nmod=(n-3)%11;k=(5*k)%11;ans=0
for j in range(5):
  i=0
  while (7*i+9+j)%11!=k:i+=1
  ans+=(n-3)//11+(nmod>=i)
print(ans)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())

cnt = 0
cnt += ((n - 2) // 11) * 5#(n - 1) -2 + 1
for i in range(2 + ((n - 2) // 11) * 11, n):
    for j in range(2, 6 + 1):
        if 9 * (7 * (i - 1) + j) % 11 == k:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n, k = map(int, raw_input().split(' '))

m = n -2
ans = 5*int(m/11)
for i in xrange(m % 11):
    i += 1
    for j in xrange(7-2):
        j += 1
        s = 9*(7*i+j+1)

        if ((s % 11) == k):
            ans +=1
print ans

Submission status: Accepted

Solution code:
n,k = (int(i) for i in input().split())
x = [[4,2,0,9,7]]+[[0 for i in range(5)] for i in range(10)]
for i in range(1,11):
	for j in range(5):
		x[i][j] = (x[i-1][j]+8)%11
ans,m = ((n-2)//11)*5,(n-2)%11
for i in range(m): ans+=x[i].count(k)
print(ans)

Submission status: Accepted

Solution code:
import sys
N, K = [int(i) for i in input().split()]
if N <= 2:
    print(0)  # 2段以下のカレンダーでは3x3の正方形を作りようがない
    sys.exit()

ans = 0
for i in range(min(N - 3 + 1, 11)):
    for j in range(5):
        # 3x3の真中のマスの整数をxとすると、正方形内の数字の和は9x
        # xはカレンダーの端でないことから、
        # x = 7(i-1) + j (2 <= i <= n-1, 2 <= j <= 6)
        # x = 7(i+1) + (j+2) (0 <= i <= n-3, 0 <= j <= 4)
        # と表されるので、この範囲で合同式を満たす整数の組(i,j)の個数が解。

        # jを固定したとき i=11q+r と表すことにすると、 0<=i<=10 の範囲で
        # 解は唯一存在する(その値はr)。iを11で剰余を取った値はすべて異なるから。
        # i,jをこの範囲で動かし、条件を満たす組の個数がわかれば、
        # 全体での個数もわかる。
        if 9 * (7 * (i + 1) + (j + 2)) % 11 == K:
            r = i % 11
            # ある場所(r,j)が条件を満たすなら、そこに丸をつけてみる。
            # すると、(r+11t,j)にも丸をつけることになる。
            # カレンダーのうち丸をつける可能性のある場所の数は、
            # 11行5列のグリッドが (N-3)//11 個、row行5列のグリッドが1個ある。
            # もしrowの値がrより小さかったなら、row行5列のグリッドのj列目に
            # 丸をつけられる場所はない。
            ans += ((N - 3) // 11) + (1 if (N - 3) % 11 >= r else 0)
print(ans)

Submission status: Accepted

Solution code:
def main():
    """
    カレンダーらしいもの: 7列…

    3x3の和: 2列目x3
    2列目の平均: (2,2)
    より,(2,2)*9

    11で割った余り
    9............13
    16...........20
    ...

    9,10,0,1,2
    5,6, 7,8,9

    [以下、解説の(自分用の)補完]
    9x ≡  k mod 11
     x ≡ 5k mod 11 ?

    わからんーとTweetしたら, 引用で解説されてた(感謝)
    1. https://twitter.com/hogeover30/status/995618880830636032
    2. https://mathtrain.jp/mod

        45x     ≡ 5k mod 11 (両辺等倍しても剰余は変わらない, 性質3)
        44x + x ≡ 5k mod 11 (求めたいxと 11で割り切れる倍数に分解, 性質1)
              x ≡ 5k mod 11

    範囲の変更
        7i + j - 7 (2<=i<=n-1, 2<=j<=6)
        7i + j + 9 (0<=i<=n-3, 0<=j<=4)
            7*2 + 1*2 = 16
            16 - 7 = 9

    7i に着目(入力例4, n=100, k=8)
        j=0: 7i+9  ≡ 5k ≡ 40 (mod 11) => 7i ≡ 9 (mod 11) ※1
        j=1: 7i+10 ≡ 5k ≡ 40 (mod 11) => 7i ≡ 8 (mod 11) ※2
            ※1: 40-9 (31) mod 11 = 9 より (性質2)
            ※2: 40-10(30) mod 11 = 8 より

            i={6,17,28,39,50,61,72,83,94}
            i={9,20,31,42,53,64,75,86,97}

    j固定: i = 11q + r
        1: r=6
        2: r=9
    結局、規則はなんとなく分かるが証明しろと言われると説明できない
    """
    n, k = map(int, input().split())

    # part1(n, k)
    # f2(n, k)
    editorial(n, k)


def f2(n, k):
    """規則をなんとなく見つけた場合
    """
    table = []
    for i in range(2, 2+11):
        table.append(
            [(7*i + j - 7) * 9 % 11 for j in range(2, 6+1)]
        )

    # 最初と最後の1行ずつ不要
    n -= 2
    # 11ごとに1つ解が存在し5列分
    ans = n // 11 * 5
    # 余った行ごとに残りの判定
    x = n % 11
    for i in range(x):
        for j in range(5):
            if table[i][j] == k:
                ans += 1

    print(ans)


def editorial(n, k):
    ans = 0
    # 列ごと: 2行目2-6列目
    for j in range(2, 6+1):
        rownum = 0
        for i in range(2, n):
            s = (i * 7 + j - 7) * 9
            if s % 11 == k:
                rownum = i
                break

        if rownum == 0:
            continue

        # 11行ごとに余りkになるため、見つかった基準の分の+1
        # 最後の1行不要, rownumずらしておく
        ans += 1
        ans += (n - 1 - rownum) // 11

    print(ans)


def part1(n, k):
    ans = 0

    for i in range(1, n-3+2):
        for j in range(1, 5+1):
            s = 0
            for y in range(3):
                for x in range(3):
                    s += 7*(i+y) + (j+x) - 7
            # print(i, j, s, sep="\t")
            if s % 11 == k:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
#(i,j)=7i+j-7
x=0
for i in range(11):
    if (9*i)%11==k:
        x=i
        break
K=0
L=0
for i in range(1,78):
    if i%11!=x:
        continue
    if i%7<=1:
        continue
    K+=1
    if i<=7:
        L+=1
P=0
for i in range(1,7*(n%11)+1):
    if i%11!=x:
        continue
    if i%7<=1:
        continue
    if i>(7*(n%11)-7):
        continue
    P+=1
print(K*(n//11)+P-L)

Submission status: Accepted

Solution code:
n,k = list(map(int,input().split()))

a = 4;b = 2;c = 0;d = 9;e = 7
f = [a,b,c,d,e]
ans = 0
for i in range((n-2)%11):
	if k in (a,b,c,d,e):
		ans += 1
	a = (a+8)%11
	b = (b+8)%11
	c = (c+8)%11
	d = (d+8)%11
	e = (e+8)%11

print(ans+((n-2)//11)*5)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
if N < 3:
    print(0)
    exit()

mem = [0] * 11
for i in range(11):
    for j in range(2,7):
        n = i*7 + j
        if (9*n)%11 == K: mem[i] += 1

ans = sum(mem) * (N//11)
ans -= mem[0]
if N%11 == 0:
    ans -= mem[-1]
else:
    ans += sum(mem[:N%11 - 1])
print(ans)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
d = [11, 16, 10, 25, 9, 24, 19, 13, 18, 12, 17]
e = 7 * (n - 1)
r = (e - d[k] - 1) // 77
print(5 * r + len([x for x in range(d[k] + 77 * r, e, 11) if x % 7 > 1]))

Submission status: Accepted

Solution code:
mod=11
n,k=map(int,raw_input().split())
k=(k-8)%mod
last=7*n-7*2-2
idx=-1
for i in xrange(1,last+1):
    if 3*(i+i+1+i+2)%mod==k:
        idx=i
        break
r2idx=r1idx=-1
for i in xrange(1,n+1):
    if (7*i-1-idx)%11==0:
        r2idx=7*i-1
        break
for i in xrange(1,n+1):
    if (7*i-idx)%11==0:
        r1idx=7*i
        break
if idx==-1:
    print(0)
    exit()
if r1idx==-1:
    if r2idx==-1:
        print((last-idx)/11+1)
    else:
        print((last-idx)/11+1-(last-r2idx)/(7*11)-1)
else:
    if r2idx==-1:
        print((last-idx)/11+1-(last-r1idx)/(7*11)-1)
    else:
        print((last-idx)/11+1-(last-r2idx)/(7*11)-1-(last-r1idx)/(7*11)-1)

#print r1idx,r2idx,idx
#print((last-idx)/11+1-(last-r2idx)/(n*11)-1-(last-r1idx)/(n*11)-1)

Submission status: Accepted

Solution code:
n,k=map(int,input().split());n-=2;h=[sum(k==(8*i+j)%11for j in[4,2,0,9,7])for i in range(11)];print(n//11*sum(h)+sum(h[:n%11]))

Submission status: Accepted

Solution code:
n,k=map(int,input().split());n-=2;h=[sum(k==(63*i+j)%11for j in[4,2,0,9,7])for i in range(min(n,11))];print(n//11*sum(h)+sum(h[:n%11]))

Submission status: Accepted

Solution code:
n,k=map(int,input().split());n-=2;h=[sum((63*i+9*j+81)%11==k for j in range(5))for i in range(min(n,11))];print(sum(h)*(n//11)+sum(h[:n%11]))

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

n, k = map(int, input().split())
n = max(0, n-2)
ans = 0
h = [sum((63*i+9*j+81) % 11 == k for j in range(5))for i in range(min(n, 11))]
ans = sum(h) * (n // 11) + sum(h[i] for i in range(n % 11))
print(ans)

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

n, k = map(int, input().split())
n = max(0, n-2)
ans = 0
f = lambda i, j : sum(7*(i+x//3+1)+(j+x%3+1)-7 for x in range(9)) % 11 == k
h = [0] * 11
for i in range(min(n, 11)):
    h[i] = sum(1 for x in range(5) if f(i, x))
ans = sum(h) * (n // 11) + sum(h[i] for i in range(n % 11))
print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,raw_input().split())
ans=5*(n/11)
inv=(5*k)%11
for i in range(1,max(1,(n%11-1)*7+1)):
    if i%7 not in (1,0) and i%11==inv:ans+=1
for i in range(1,8):
    if i%7 not in (1,0) and i%11==inv:ans-=1
print ans

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
d = [11, 16, 10, 25, 9, 24, 19, 13, 18, 12, 17]
e = 7 * (n - 1)
r = (e - d[k] - 1) // 77
print(5 * r + len([x for x in range(d[k] + 77 * r, e, 11) if x % 7 > 1]))

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[7*i+j-7 for j in range(1, 7+1)] for i in range(1, min(n+1, 14))]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
h = [0] * 11
for i in range(min(max(0, n-2), 11)):
    for j in range(7-2):
        if f(i, j) :
            h[i] += 1
cnt = sum(h) * ((n-2) // 11)
for i in range((n-2) % 11):
    cnt += h[i]
print(cnt)

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))

p = int((n - 2) / 11)
c = p * 5
for i in range(2 + p * 11 , n):
    for j in range(2, 7):
        if (7 * i + j - 7) * 9 % 11 == k:
            c += 1

print(c)

Submission status: Accepted

Solution code:
#import string,itertools,fractions,heapq,re,array,bisect
#from math import *
#from collections import Counter
def rl(s): return xrange(len(s))

INF = 2147483647


import sys
stdin = sys.stdin

N, K = map(int, stdin.readline().strip().split())


m = 100
grid = [range(start, start+7) for start in range(1, m*7, 7)]

for_y = [0] * 11
for y in range(11):
    for x in range(5):
        here = sum(sum(grid[y+i][x:x+3]) for i in range(3))
        if here % 11 == K:
            for_y[y] += 1

#print for_y
N -= 2
if N <= 2:
    print 0
else:
    rr = (N // 11) * sum(for_y)
    extra = N % 11
    if extra >= 1:
        rr += sum(for_y[:extra])

    print rr

Submission status: Accepted

Solution code:
n, k = map(int, raw_input().split())
n -= 2
if n < 0:
    print 0
    quit()
p, q = divmod(n, 11)
c = e = 0
for i in xrange(11):
    s = 7 * i + 1
    a = 0
    for j in xrange(5):
        t = ((s + j) * 9 + 9 + 21 + 42) % 11
        a += t == k
    if i < q:
        e += a
    c += a
print e + c * p

Submission status: Runtime Error

Solution code:
n, k = map(int,input().split())
if n < 3:
    print(0)
    exit()

table = [[0] * 5 for i in range(11)]
for i in range(11):
    for j in range(5):
        t = 9 * (j + 2 + 7 * (i + 1))
        table[i][j] = t % 11

c = [0]
for row in table:
    c.append(c[-1] + row.count(K))

d,m = divmod(n - 2, 11)
ans = c[m] + c[-1] * d
print(ans)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
print(a+b)

Submission status: Runtime Error

Solution code:
n,k = int(input())
a = [0,5,10,4,9,3,8,2,7,1,6]
r = a[k]
s = 0
for i in range(2,n):
  for j in [2,3,4,5,6]:
    if (7*i + j - 7 - r)%11 == 0:
      s += 1
print(s)

Submission status: Runtime Error

Solution code:
a = 4;b = 2;c = 0;d = 9;e = 7
f = [a,b,c,d,e]
ans = 0
for i in range((n-2)%11):
	if k in (a,b,c,d,e):
		ans += 1
	a = (a+8)%11
	b = (b+8)%11
	c = (c+8)%11
	d = (d+8)%11
	e = (e+8)%11

print(ans+((n-2)//11)*5)

Submission status: Runtime Error

Solution code:
mod=10**9+7
n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
dp=[[[0]*(1<<8) for _ in xrange(n+1)] for _ in xrange(n+1)]
for i in xrange(n):
    dp[i+1][1][a[i]]=1
for i in xrange(n):
    for j in xrange(n):
        for l in xrange(1<<8):
            dp[i+1][j+1][a[i]^l]+=(j+1)*dp[i][j][l]%mod
            dp[i+1][j][l]+=dp[i][j][l]%mod
ans=0
for j in xrange(1,n+1):
    ans=(ans+dp[n][j][k])%mod
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
k = int(input())

vl = []
rl = []
for v in range(n):
    kari_value = []
    for v2 in range(v*7+1, v*7+1+7):
        kari_value.append(v2)
    vl.append(kari_value)
   
for v in range(len(vl)-2):  # 縦の繰り返し
  for v2 in range(len(vl[0])-2):  # 横の繰り返し
    s = vl[v][v2] + vl[v][v2+1] + vl[v][v2+2] + vl[v+1][v2] + vl[v+1][v2+1] + vl[v+1][v2+2] + vl[v+2][v2] + vl[v+2][v2+1] + vl[v+2][v2+2]
    if (s % 11 == k) :
      rl.append(1)
    
print(sum(rl))

Submission status: Runtime Error

Solution code:
n = int(input())
k = int(input())

vl = []
rl = []
for v in range(n):
    kari_value = []
    for v2 in range(v*7+1, v*7+1+7):
        kari_value.append(v2)
    vl.append(kari_value)
    
# print(value_list)
# print(len(value_list), len(value_list[0]))

for v in range(len(vl)-2):  # 縦の繰り返し
  for v2 in range(len(vl[0])-2):  # 横の繰り返し
    s = vl[v][v2] + vl[v][v2+1] + vl[v][v2+2] + vl[v+1][v2] + vl[v+1][v2+1] + vl[v+1][v2+2] + vl[v+2][v2] + vl[v+2][v2+1] + vl[v+2][v2+2]
    # print(s % 11)
    if (s % 11 == k) :
      rl.append(1)
    
print(sum(rl))