package main import . "fmt" import . "strings" func main() { var h,w int Scan(&h,&w) ss:=make([]string,h) for i:=range ss { var s string Scan(&s) s=ReplaceAll(s,".","a") s=ReplaceAll(s,"#",".") ss[i]=ReplaceAll(s,"a","#") } var x,y int for i,s:=range ss { var t string Scan(&t) if s!=t { x++ } if ss[h-1-i]!=t { y++ } } if x>0&&y>0 { Println(-1) } else { Println("3.5317401904617327") } }