Query syntax for modulo operator applied to sum

I’m trying to use the modulo operator to constrain direction calculations within 0-360. I first need to reverse the direction by 180. Here is the query:

SELECT last("value") +180 % 360 FROM "tsdata" WHERE ("var" = '35') AND time >= now() - 5m

The last(“value”) is 343, and the result of the query is 523. I was expecting 163.

It seems that the modulo operator does not get applied to the sum. Perhaps this is an operator precedence issue? What is the correct notation to apply the modulo operator after the sum has been comptuted?

Here is the result from the Grafana query inspector:

{
  "xhrStatus": "complete",
  "request": {
    "method": "GET",
    "url": "api/datasources/proxy/1/query",
    "params": {
      "db": "chords_ts_production",
      "q": "SELECT last(\"value\") +180 % 360 FROM \"tsdata\" WHERE (\"var\" = '35') AND time >= now() - 5m",
      "epoch": "ms"
    },
    "data": null,
    "precision": "ms"
  },
  "response": {
    "results": [
      {
        "statement_id": 0,
        "series": [
          {
            "name": "tsdata",
            "columns": [
              "time",
              "last"
            ],
            "values": [
              [
                1573154988000,
                523
              ]
            ]
          }
        ]
      }
    ]
  }
}