module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return r[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var i in r)t.d(n,i,function(e){return r[e]}.bind(null,i));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=1)}([function(r,e,t){"use strict";r.exports=class{constructor(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=r.length,this.items=r,this.ind=0}enq(r){this.size+=1,this.items.push(r)}deq(){var r=this.items[this.ind];return this.size-=1,this.ind+=1,r}clear(){this.items=[],this.size=0,this.ind=0}}},function(r,e,t){"use strict";var n=t(2),i=new(t(3))(n.readFileSync("/dev/stdin","utf8").trim().split(/\s+/g));t(4)(i)},function(r,e){r.exports=require("fs")},function(r,e,t){"use strict";var n=t(0);r.exports=class{constructor(r){this.inp=new n(r)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(r,e,t){"use strict";t(0);r.exports=function(r){for(var e=r.in(),t=new Array(e),n=0;n<e;n++){for(var i=new Array(10),o=0;o<10;o++)i[o]=r.in();t[n]=i}for(var s=new Array(e),u=0;u<e;u++){for(var a=new Array(11),f=0;f<11;f++)a[f]=r.in();s[u]=a}for(var c=-9999999999,l=1;l<1024;l++){for(var d=0,p=new Array(10),v=0;v<10;v++)p[v]=(l>>9-v)%2;for(var h=0;h<e;h++){for(var y=0,b=0;b<10;b++)1==p[b]&&1==t[h][b]&&y++;d+=s[h][y]}d>c&&(c=d)}console.log(c)}}]);