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